Skip to content

Instantly share code, notes, and snippets.

@hisasann
Created February 17, 2020 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisasann/8b1277c117c28fbf1ed57b343690122a to your computer and use it in GitHub Desktop.
Save hisasann/8b1277c117c28fbf1ed57b343690122a to your computer and use it in GitHub Desktop.
contentful で getEntry する簡単なサンプル
const contentful = require("contentful");
const client = contentful.createClient({
// This is the space ID. A space is like a project folder in Contentful terms
space: "ra794i9t0yln",
// This is the access token for this space. Normally you get both ID and the token in the Contentful web app
accessToken: "U1Wffn5NIhptGsWKyliQCILCWpoaCjJK6mwJwYO_58g"
});
// This API call will request an entry with the specified ID from the space defined at the top, using a space-specific access token.
client.getEntries()
.then((response) => console.log(response.items))
.catch(console.error)
client.getEntry('7gXAjvVRrjBMK4XbuJ8TVO')
.then((entry) => console.log(entry))
.catch(console.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment