Rest - Admin - Change Log
Purpose
The intention of this API is to allow a system to keep in sync with the views server or trigger custom actions on data changes.
Please note: This API is still in development. While this API is stable and all the methods documented on this page will be improved rather than than changed, it will be with checking back with this documentation prior to any new interactions with this API.
Base URL
http://app.views.coop/api/restful/admin/changelog
Basic Usage
curl --url <Base URL> -u<username>:<password> -H Content-Type:text/xml
This will return something similar to:
<?xml version="1.0" encoding="utf-8"?> <changelog> <log id="8487"> <object>Agency</object> <objectId>354</objectId> <action>edit</action> <timestamp>2014-02-07T10:42:40</timestamp> <username>nowhere.man</username> </log> <log id="8488"> <object>PersonContact</object> <objectId>1</objectId> <action>update</action> <timestamp>2014-02-07T10:43:13</timestamp> <username>nowhere.man</username> </log> <log id="8489"> <object>Booking</object> <objectId>245</objectId> <action>update</action> <timestamp>2014-02-07T10:43:26</timestamp> <username>nowhere.man</username> </log> <log id="8490"> <object>SessionGroup</object> <objectId>8</objectId> <action>insert</action> <timestamp>2014-02-07T10:43:29</timestamp> <username>nowhere.man</username> </log> <log id="8492"> <object>Participant</object> <objectId>25489</objectId> <action>update</action> <timestamp>2014-02-07T10:43:29</timestamp> <username>al.mccaig.transit</username> <relates> <Session>606</Session> <Person>1</Person> </relates> </log> </changelog>
Object Specific Calls
If you are only interested to changes to a specific object, you can append the object name to the call:
curl --url <Base URL>/<objectType> -u<username>:<password> -H Content-Type:text/xml
- objectType - One for the following values
- AgencyProject
- Note
- Participant
- Person
- PersonContact
- Questionnaire
- Session
- SessionGroup
- ValueList
e.g. for sessions
curl --url <Base URL>/session -u<username>:<password> -H Content-Type:text/xml
Restricting the changes by date
By default the API will return up to the last 4000 changes logged. However, you can fetch specific date ranges using the timestamp
, you can also use the -from and -to modifiers to specify a date range:
curl --url <Base URL>/<objectType>?timestamp-from=<date>×tamp-to=<date> -u<username>:<password> -H Content-Type:text/xml