Agility Fetch API JS SDK for synchronizing content from Agility CMS
- Source:
Methods
(static) getSyncContent(requestParams) → {Promise.<AgilityFetch.Types.SyncContent>}
Retrieves a list of content items that need to be synced based on the provided sync content items token, and returns the next sync token.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestParams |
Object
|
The paramters for the API request.
|
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
guid: 'ade6cf3c',
apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
api.getSyncContent({
syncToken: '0', //to start a new sync
locale: 'en-us',
pageSize: 500
})
.then(function(contentList) {
console.log(contentList.items);
//the next sync token to use, continue to call this method (loop) until no sync token is provided in the response. This indicates your are up to date.
console.log(contentList.syncToken);
})
.catch(function(error) {
console.log(error);
});
(static) getSyncPages(requestParams) → {Promise.<AgilityFetch.Types.Page>}
Retrieves a list of pages that need to be synced based on the provided sync pages token, and returns the next sync token.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestParams |
Object
|
The paramters for the API request.
|
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
guid: 'ade6cf3c',
apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
api.getSyncPages({
syncToken: '0', //to start a new sync
locale: 'en-us',
pageSize: 500
})
.then(function(pages) {
console.log(pages.items);
//the next sync token to use, continue to call this method (loop) until no sync token is provided in the response. This indicates your are up to date.
console.log(pages.syncToken);
})
.catch(function(error) {
console.log(error);
});