Agility Fetch API JS SDK for retrieving pages from the Agility CMS
- Source:
Methods
(static) getPage(requestParams) → {Promise.<AgilityFetch.Types.Page>}
Gets the details of a page by its Page ID.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| requestParams | Object | The parameters for the API request. 
 | 
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
  guid: 'ade6cf3c',
  apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
api.getPage({
    pageID: 1,
    languageCode: 'en-us'
})
.then(function(page) {
    console.log(page);
})
.catch(function(error) {
    console.log(error);
});(static) getSitemapFlat(requestParams) → {Promise.<AgilityFetch.Types.SitemapFlat>}
The sitemap, returned in a flat list, where the dictionary key is the page path. This method is ideal for page routing.
- Source:
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| requestParams | Object | The parameters for the API request. 
 | 
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
  guid: 'ade6cf3c',
  apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
api.getSitemapFlat({
     channelName: 'website',
     languageCode: 'en-us'
})
.then(function(sitemap) {
     console.log(sitemap);
})
.catch(function(error) {
     console.log(error);
});(static) getSitemapNested(requestParams) → {Promise.<AgilityFetch.Types.SitemapNested>}
Gets the sitemap as an array in a nested format, ideal for generating menus.
- Source:
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| requestParams | Object | The parameters for the API request. 
 | 
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
  guid: 'ade6cf3c',
  apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
api.getSitemapNested({
     channelName: 'website',
     languageCode: 'en-us'
})
.then(function(sitemap) {
     console.log(sitemap);
})
.catch(function(error) {
     console.log(error);
});(static) getUrlRedirections(requestParams) → {Promise.<AgilityFetch.Types.Gallery>}
Gets the details of a gallery by their Gallery ID.
- Source:
Parameters:
| Name | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| requestParams | Object | The parameters for the API request. 
 | 
Example
import agility from '@agility/content-fetch'
const api = agility.getApi({
  guid: 'ade6cf3c',
  apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
});
let dateObj = null;
api.getUrlRedirections({
    lastAccessDate: dateObj
})
.then(function({urlRedirections, lastAccessDate}) {
    console.log(urlRedirections.length, lastAccessDate);
})
.catch(function(error) {
    console.log(error);
});