You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your example only shows how to receive events when we already have the sync token.
But atleast your example does not provide the new sync token for the next call.
importasanafromasana.restimportApiExceptionfrompprintimportpprintconfiguration=asana.Configuration()
configuration.access_token='<YOUR_ACCESS_TOKEN>'api_client=asana.ApiClient(configuration)
# create an instance of the API classevents_api_instance=asana.EventsApi(api_client)
resource="12345"# str | A resource ID to subscribe to. The resource can be a task, project, or goal.opts= {
'sync': "de4774f6915eae04714ca93bb2f5ee81", # str | A sync token received from the last request, or none on first sync. Events will be returned from the point in time that the sync token was generated. *Note: On your first request, omit the sync token. The response will be the same as for an expired sync token, and will include a new valid sync token.If the sync token is too old (which may happen from time to time) the API will return a `412 Precondition Failed` error, and include a fresh sync token in the response.*'opt_fields': "action,change,change.action,change.added_value,change.field,change.new_value,change.removed_value,created_at,parent,parent.name,resource,resource.name,type,user,user.name", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
}
try:
# Get events on a resourceapi_response=events_api_instance.get_events(resource, opts)
fordatainapi_response:
pprint(data)
exceptApiExceptionase:
print("Exception when calling EventsApi->get_events: %s\n"%e)
Without the sync token this part of the API is not that helpful.
The text was updated successfully, but these errors were encountered:
See my comment for a workaround here. Thanks for pointing this out. I think it's probably best for us not to try to auto paginate our events endpoint and let users handle how they want to call our events endpoint.
The problem with auto paginating our events endpoint is we have to decide when to stop the iteration. So we could either stop the iteration when the Asana API returns has_more is false OR keep calling the next sync token making the get_events method turn into an event stream where it constantly fetches and watches for new events. If we go with the event stream approach we'll need to add some kind of delay otherwise it'll hit the Asana API rate limits.
What's your use case with our events endpoint? And how would you prefer this endpoint behaves for python?
Your example only shows how to receive events when we already have the sync token.
But atleast your example does not provide the new sync token for the next call.
Without the sync token this part of the API is not that helpful.
The text was updated successfully, but these errors were encountered: