Get all events from a project or task


#1

Hello,

I am trying to retrieve events data for a project or a task, either way, when I go to
https://app.asana.com/api/1.0/events?resource=ProjectId
or https://app.asana.com/api/1.0/events?resource=TasktId

I get the sync token, and I put it at the end of the url:
let’s say the token is 1234a:0 and the project or task code is 5678 (I know is longer, but for the practical example):
Then I put the token as follows:
https://app.asana.com/api/1.0/events?resource=5678&sync=1234a:0

I would get:
{
“data”: ,
“sync”: 1234a:0"
}

But I get no data and a new sync token, that only changes in the last digit after the “:”, increasing by one.

Is there a way that I can get all the events?

Thanks


#2

Hi @carolina, sorry to hear you’re having issues – events can be a bit confusing to work with. I assume you’ve already taken a look at the event docs, but i’ll link to them for other developer’s reference who may read this thread.

I think you have the right idea. My guess is that the data object is empty in your response because nothing has changed with the resource since getting that sync token. Here’s how you can test to make sure that you’re using events successfully:

  1. Request an initial sync token (GET /events?resource=<resouce-id>)
  2. You will receive a 412 error that also includes a sync token. Use that token in your next request.
  3. Go to the resource in the Asana web product and make some changes to it (e.g. add a comment if it’s a task)
  4. Make a request using the sync token from above (GET /events?resource=<resouce-id>?sync=<initial-sync-token>
  5. The response will include the changes that you made to the resource.

Let us know if you need more help getting unblocked.