Each entry in the feed represents a relevant event that happened on a specified resource at specified time.
Currently, entries in the feed are generated for three types of events per resource:
- The creation of the resource.
- The modification of any attribute or link of the resource.
- The deletion of the resource.
This is an example of the XML representation of the event feed:
<events type="array"> <event> <id type="integer">40393</id> <event-type>job_created</event-type> <timestamp type="datetime">2012-12-03T09:35:37+00:00</timestamp> <link rel="subject" href="https://sequence.example.com/api/work_areas/85/jobs/97185"/> </event> <event> <id type="integer">40397</id> <event-type>asset_updated</event-type> <changes>status,name</changes> <timestamp type="datetime">2012-12-03T09:35:39+00:00</timestamp> <link rel="subject" href="https://sequence.example.com/api/work_areas/85/jobs/97185/assets/467237"/> </event> <event> <id type="integer">40401</id> <event-type>task_destroyed</event-type> <timestamp type="datetime">2012-12-04T14:46:55+00:00</timestamp> <link rel="subject" href="https://sequence.example.com/api/work_areas/85/jobs/97144/tasks/3030"/> </event> </events>
id(integer, read only): The identifier of the event. Events are presented ordered by
idand they can be filtered with the
newer_thanparameter (see below). You may want to store the
idof the last processed event so that they don’t process twice the same event.
event-type(string, read only): The type of the event. The list of supported events is specified in a section below. The format of the
event-typeis as follows:
_. Currently, there are three possible operations:
created: For the creation of the resource.
updated: For the modification of any attribute or link of the resource.
deleted: For the deletion of the resource.
changes(string, comma-separated, read only): The list of attributes and links that changed. This attribute is only present if the
*_update. This list refers to the names of the attributes and to the “rels” of the links of the resource that have changed. To know what are the new values for those attributes or links, you’ll have to follow the
subjectlink. The attribute
statusfrom a job is an exception to this and, by the moment, is not tracked in the list of changed attributes listed for the events
timestamp(datetime, read only): The date and time when the event occurred.
subject: The resource that was created, updated or deleted.
Note: When trying to access the subject link of the events a HTTP response code of
404(Not Found) might be returned. It means just that the requested resource cannot be found (because it has been deleted). Probably there will be a newer event of the type
job_deleted) in the feed pending to be processed.
Getting the event feed
The event feed is linked from the root of the Sequence API:
$ curl --digest -u "api_user:password" https://sequence.example.com/api
<?xml version='1.0' encoding='utf-8' ?> <sequence> <!-- ... --> <link href="https://sequence.example.com/api/events" rel="events"/> </sequence>
events link you’ll get the event feed:
$ curl --digest -u "api_user:password" https://sequence.example.com/api/events
<?xml version='1.0' encoding='utf-8' ?> <events type="array"> <!-- ... --> </events>
The event feed is limited to show no more than 50 events in ascending order of their timestamps (i.e. older events will appear first). You can navigate and filter the event feed using the attributes described in the following section.
You can also pass the following attributes in order to filter the event feed:
newer\_than(integer, it can be used with any other parementer): This parameter filter the feed to include only events that are newer than another one. The value of this parameter will be the
idof the event taken as a reference.
/api/events?newer_than=234will return events more recent than the event 234. Typically, you may want to store locally the id of the last event you have processed so that in the next processing you only request the events newer than the last one you processed. Also, given that the event feed is limited to 50 entries, you should use the
newer_thanparameter to navigate the feed until reaching the last event.
event\_type(string, comma-separated, it can be used with any other parameter): This parameter will allow clients to filter the feed to include only entries for certain event types. The value of this parameter will be a list of event types separated by commas. For example:
/api/events?event_type=job_created,task_updatedwill return only events whose
You are encouraged to use the
event_typefilter to fetch only those event types which are relevant to you, avoiding unnecessary processing. Currently the supported event types are:
Last updated March 31st, 2017.