Changes list v1
OVERVIEW
Note: The latest specification for Collaborate 4.1.4 and above is here
This API helps to fetch a list of changes to the files / folder resource since the last sync operation by the client. The changes API is based on event / audit logs which make up our admin audit reports. The changes list is time-sequenced list maintained separately for each user and device. We call it sync_position. When a client application wants to fetch the changes since the last fetch operation, they send over their sync_position in the GET request and we return all changes since the sync_position. The content returned in to the client are paginated. Individual resource items are embedded in the response content.
To initialize the client call the changes API with an empty sync_position and all events related to the specific folder will be sent to the client. The client can send a sync_position=current to get the current sync position.
Workflow for the client application being setup for the first time
· A client that has just been configured can call sync_position = current to get the current sync position
· Call the /files API to get a list of all of the files for the specific folder
· Call the /changes API to get hold of any changes since the sync_position = current
· Decide how frequent to call the server API based on the total_changes for the specific client on the server.
The above call sequence will help the client to initialize the sync folder.
Any actions taken by the specific client are recorded in the events log with the id of the specific source.
Purpose
The purpose of this API is to give you sync changes detail. Anyone can call this API to get sync changes detail.
GET /api/1/changes
Parameters
Parameter Name |
Value |
Description |
---|---|---|
syncpositionid |
int |
The start location for the content sync. All items from the syncpositionid will be returned. |
limit |
int |
The no of items to return for this request |
contenttype |
string |
the type of content for which the changes are required, the default is all but you can folder the changes by the following content types |
siteid |
int |
User can filter by site |
Event Object
Global attributes
Parameter |
Type |
Description |
nextsyncposition |
int |
The next sync position the client should use to obtain changes |
User attributes
Parameter |
Type |
Description |
changeid |
int |
sync position id of each activity. |
contenttype |
string |
Type of content, file or folder |
eventid |
int |
the unique id for each event |
createdby |
object |
the user who created the event, this is a user object |
creationdate |
date |
The time the event was created |
sourceclient |
string |
The dynamic id provided by client when calling API's to store in db, this will be returned to the client at the time of returning changes API results. |
itemdetails |
object |
The metadata of the item which was modified. e,g content's id, name, parentid fields. |
API Assumptions
1. Creation date format is "dd MMM yyyy HH:mm" format and in "UTC" timezone.
2. URL End POINT: /api/{version}/changes Method : GET Ex: /api/1/changes
3. Optional query parameter details are as under:
syncpositionid : – next sync position id if provided then sync changes greater than these id will be given otherwise response with current sync position id only (without activities).If syncpositionid=0 then first 500 top activities will be given in the response.
limit : – to limit the number of records if provided then no of sync changes will be given otherwise default is 500.
contenttype : – to get the specific content like 'Files' (it is only one right now). If provided then will give specific type of sync changes record otherwise all types will be delivered. "contenttype=files" will return both file and folder contents.
siteid : – This is to get filter by site. If provided then will give site specific sync changes otherwise all.
Ex: /api/1/changes?syncpositionid=40&limit=30&contenttype=files&siteid=1
4. If the user wants to provide the sourceclient for Every API call(/User Events) then they need to provided dynamic value through the query parameter called "sourceclient" E.g. sourceclient=MyPC in the URL.
5. "sourceclient" text limit is max 50 characters. If longer "sourceclient" value is provided then it will be automatically trimmed to first 50 characters only.
6. Minimum access for changes API is Content Admin. Normal user can call the API but can not see any item changes he can only see the nextsyncpositionid.
7. parentid under itemdetails will be returned 0 for document delete and folder delete activities.
8. File & folder permanently deleted events will not be coming while get sync changes list in changes API.
Response XML
If successful the response body will contain the following structure
<changes>
<nextsyncposition>155</nextsyncposition>
<items>
<item>
<changeid>105</changeid>
<contenttype>CONTENT_FOLDER</contenttype>
<eventid>16</eventid> (Use the user events table below to determine the event type )
<sourceclient>folderrestorepc</sourceclient>
<createdby>
<firstname>Saviz</firstname>
<lastname>Izadpanah</lastname>
<email>saviz.izadpanah@highq.com</email>
<userid>11</userid>
</createdby>
<createddate>25 Sep 2014 13:44</createddate>
<itemdetails>
<id>41</id>
<name>f2</name>
<parentid>2</parentid>
</itemdetails>
</item>
<item>
<changeid>155</changeid>
<contenttype>CONTENT_DOCUMENT</contenttype>
<eventid>1</eventid>
<sourceclient />
<createdby>
<firstname>Saviz</firstname>
<lastname>Izadpanah</lastname>
<email>saviz.izadpanah@highq.com</email>
<userid>11</userid>
</createdby>
<createddate>25 Sep 2014 13:44</createddate>
<itemdetails>
<id>33</id>
<name>ACE</name>
<parentid>5</parentid>
</itemdetails>
</item>
</items>
</changes>
Response Code
Code |
Meaning |
200 |
Get Changes List successfully |
400 |
Problem with parsing XML or JSON object (Bad Request) |
401 |
Unauthorized |
403 |
Validation failed/ Forbidden |
405 |
Method not allowed (calling api with wrong method) |
500 |
Internal error occured |
User Events (The number is the eventid of the event) |
|
Comments
0 Comments