Skip to content

Instantly share code, notes, and snippets.

@jamesvidler
Last active August 13, 2019 15:58
Show Gist options
  • Save jamesvidler/5a4b76bf1b3b60ec6b571262ecd70d00 to your computer and use it in GitHub Desktop.
Save jamesvidler/5a4b76bf1b3b60ec6b571262ecd70d00 to your computer and use it in GitHub Desktop.
Sample Request
import agility from '@agility/content-fetch'
const api = agility.getApi({
guid: '046a1a87',
apiKey: 'defaultlive.2b7f3a91559d794bedb688358be5e13af2b1e3ae8cd39e8ed2433bbef5d8d6ac',
isPreview: false
});
//use async to write cleaner code
let contentListResult = await api.getContentList({ referenceName: 'posts', languageCode: 'en-us' });
//do something with the list of posts...
console.log(contentListResult);
//OR use callbacks
api.getContentList({
referenceName: 'posts',
languageCode: 'en-us'
})
.then((contentListResult) => {
console.log(contentListResult);
})
.catch((error) => {
console.error(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment