Back to AsanaGet 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.
Input
type: object
properties:
parameters:
type: object
properties:
resource:
type: string
description: A resource ID to subscribe to. The resource can be a task or project.
sync:
type: string
description: >-
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_pretty:
type: boolean
description: >-
Provides “pretty” output.
Provides the response in a “pretty” format. In the case of JSON this
means doing proper line breaking and indentation to make it readable.
This will take extra time and increase the response size so it is
advisable only to use this during debugging.
opt_fields:
type: array
items:
type: string
description: >-
Defines fields to return.
Some requests return *compact* representations of objects in order to
conserve resources and complete the request more efficiently. Other
times requests return more information than you may need. This option
allows you to list the exact set of fields that the API should be sure
to return for the objects. The field names should be provided as
paths, described below.
The id of included objects will always be returned, regardless of the
field options.
required:
- resource
title: Parameters
Output
type: object
properties:
data:
type: array
items:
type: object
properties:
user:
type: object
properties:
gid:
description: Globally unique identifier of the resource, as a string.
type: string
readOnly: true
example: '12345'
x-insert-after: false
resource_type:
description: The base type of this resource.
type: string
readOnly: true
example: task
x-insert-after: gid
name:
type: string
description: '*Read-only except when same user as requester*. The user’s name.'
example: Greg Sanchez
resource:
type: object
properties:
gid:
description: Globally unique identifier of the resource, as a string.
type: string
readOnly: true
example: '12345'
x-insert-after: false
resource_type:
description: The base type of this resource.
type: string
readOnly: true
example: task
x-insert-after: gid
name:
description: The name of the object.
type: string
example: Bug Task
type:
description: >-
*Deprecated: Refer to the resource_type of the resource.* The type
of the resource that generated the event.
type: string
readOnly: true
example: task
action:
description: >-
The type of action taken on the **resource** that triggered the
event. This can be one of `changed`, `added`, `removed`, `deleted`,
or `undeleted` depending on the nature of the event.
type: string
readOnly: true
example: changed
parent:
type: object
properties:
gid:
description: Globally unique identifier of the resource, as a string.
type: string
readOnly: true
example: '12345'
x-insert-after: false
resource_type:
description: The base type of this resource.
type: string
readOnly: true
example: task
x-insert-after: gid
name:
description: The name of the object.
type: string
example: Bug Task
created_at:
description: The timestamp when the event occurred.
type: string
format: date-time
readOnly: true
example: '2012-02-22T02:06:58.147Z'
change:
type: object
properties:
field:
description: The name of the field that has changed in the resource.
type: string
readOnly: true
example: assignee
action:
description: >-
The type of action taken on the **field** which has been
changed. This can be one of `changed`, `added`, or `removed`
depending on the nature of the change.
type: string
readOnly: true
example: changed
new_value:
description: >-
*Conditional.* This property is only present when the
**field's** `action` is `changed` _and_ the `new_value` is an
Asana resource. This will be only the `gid` and `resource_type`
of the resource when the events come from webhooks; this will be
the compact representation (and can have fields expanded with
[opt_fields](/docs/inputoutput-options)) when using the [get
events](/reference/getevents) endpoint.
example:
gid: '12345'
resource_type: user
added_value:
description: >-
*Conditional.* This property is only present when the
**field's** `action` is `added` _and_ the `added_value` is an
Asana resource. This will be only the `gid` and `resource_type`
of the resource when the events come from webhooks; this will be
the compact representation (and can have fields expanded with
[opt_fields](/docs/inputoutput-options)) when using the [get
events](/reference/getevents) endpoint.
example:
gid: '12345'
resource_type: user
removed_value:
description: >-
*Conditional.* This property is only present when the
**field's** `action` is `removed` _and_ the `removed_value` is
an Asana resource. This will be only the `gid` and
`resource_type` of the resource when the events come from
webhooks; this will be the compact representation (and can have
fields expanded with [opt_fields](/docs/inputoutput-options))
when using the [get events](/reference/getevents) endpoint.
example:
gid: '12345'
resource_type: user
sync:
description: A sync token to be used with the next call to the /events endpoint.
type: string
example: de4774f6915eae04714ca93bb2f5ee81
has_more:
description: Indicates whether there are more events to pull.
type: boolean
example: true