Michael Loistl
Michael Loistl

Reputation: 271

Asana task field "hearts" user ids

Asana task field hearts contains user ids that are not equal to the workspace's user ids. Is that a bug or a feature?

According to the api documentation:

hearts

[ { id: 1123, name: 'Mittens' }, ... ]

Read-only. Array of users who have hearted this task.

Upvotes: 1

Views: 75

Answers (1)

agnoster
agnoster

Reputation: 3784

Note: a Heart is an object in its own right, with its own ID. If you want the ID of the User who "created" the heart, you need to use hearts.user.id, which is the same as the ID of the user in the workspace (i.e. you could do GET /users/:id).

Example using ?opt_expand=hearts:

 "hearts" : [
     {
        "target" : {
           "name" : "Task name here",
           "id" : 1234 // ID OF TASK
        },
        "id" : 1235, // ID OF HEART
        "user" : {
           "name" : "User name",
           "id" : 1236 // ID OF USER
        },
        "created_at" : "2015-11-30T12:40:13.516Z"
     }
  ],

Upvotes: 2

Related Questions