Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.96 KB

EventsApi.md

File metadata and controls

56 lines (39 loc) · 2.96 KB

Asana.EventsApi

All URIs are relative to https://app.asana.com/api/1.0

Method HTTP request Description
getEvents GET /events Get events on a resource

getEvents

Get events on a resource

Returns the full record for all events that have occurred since the sync token was created. A GET request to the endpoint /[path_to_resource]/events can be made in lieu of including the resource ID in the data for the request. Asana limits a single sync token to 100 events. If more than 100 events exist for a given resource, has_more: true will be returned in the response, indicating that there are more events to pull. Note: The resource returned will be the resource that triggered the event. This may be different from the one that the events were requested for. For example, a subscription to a project will contain events for tasks contained within the project.

(more information)

Example

const Asana = require('asana');

let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';

let eventsApiInstance = new Asana.EventsApi();
let resource = "12345"; // String | A resource ID to subscribe to. The resource can be a task, project, or goal.
let opts = { 
    'sync': "de4774f6915eae04714ca93bb2f5ee81", 
    '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"
};
eventsApiInstance.getEvents(resource, opts).then((result) => {
    console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
    console.error(error.response.body);
});

Parameters

Name Type Description Notes
resource String A resource ID to subscribe to. The resource can be a task, project, or goal.
sync String 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. [optional]
opt_fields Object 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. [optional]

Return type

object

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8