Last active
August 13, 2019 15:58
-
-
Save jamesvidler/5a4b76bf1b3b60ec6b571262ecd70d00 to your computer and use it in GitHub Desktop.
Sample Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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