Public
Edited
Jan 18
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
entryTypes = Object.keys(entriesByType)
Insert cell
Insert cell
Insert cell
entryCount = Object.keys(entries).length
Insert cell
Insert cell
Insert cell
Insert cell
get("5IbttfvPqN8IfW5ZRofmA8")
Insert cell
get({
sys: {
id: "5IbttfvPqN8IfW5ZRofmA8"
}
})
Insert cell
get(
"5IbttfvPqN8IfW5ZRofmA8",
"2ZeU3at6qRCRxgOWSuokVm",
"5EUNgIg5BAh3Q7RWERGWk0"
)
Insert cell
get(
"2ZeU3at6qRCRxgOWSuokVm",
[
"5EUNgIg5BAh3Q7RWERGWk0",
{
sys: {
id: "5IbttfvPqN8IfW5ZRofmA8"
}
}
],
{
sys: {
id: "5IbttfvPqN8IfW5ZRofmA8"
}
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_examplePlatformIds = fetchEntries({
content_type: "platform",
order: "fields.name",
limit: 2
})
Insert cell
Insert cell
_examplePlatformId = _examplePlatformIds[0]
Insert cell
Insert cell
_examplePlatform = entries[_examplePlatformId]
Insert cell
_examplePlatform.fields.name
Insert cell
Insert cell
Insert cell
Insert cell
fetchEntries(
{
content_type: "article",
"sys.updatedAt[gte]": "2018-01-01T00:00:00Z",
limit: 2
},
{
content_type: "game",
"fields.releaseDate[exists]": true,
order: "sys.createdAt",
limit: 2
},
{
content_type: "platform",
limit: 2
}
)
Insert cell
Insert cell
Insert cell
_exampleGameIds = fetchEntries({
content_type: "game",
"fields.platforms.sys.id": _examplePlatformId,
order: "fields.name",
limit: 5
})
Insert cell
_firstExampleGame = entries[_exampleGameIds[0]]
Insert cell
_firstExampleGameNestedPlatform = _firstExampleGame.fields.platforms[0]
Insert cell
_firstExampleGamePlatform = entries[_firstExampleGame.fields.platforms[0].sys.id]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
spaceId = _demoSpaceId
Insert cell
accessToken = _demoAccessToken
Insert cell
Insert cell
_demoSpaceId = 'mytckhnubswe' // followgaming.live
Insert cell
_demoAccessToken = 'QV9dr35NoOrKLJNkYaieOOAS3oL7wC7DgTXVl2CQYW8'
Insert cell
Insert cell
Insert cell
Insert cell
docsUrl = 'https://www.contentful.com/developers/docs/references/content-delivery-api/'
Insert cell
Insert cell
defaultLimit = 1000
Insert cell
defaultOrder = '-sys.createdAt'
Insert cell
function normalizeQuery (query) {
const q = _.isString(query) ? { content_type: query } : query

return {
...q,
order: q.order || defaultOrder,
limit: q.limit || defaultLimit
}
}
Insert cell
function sendFetchEntriesRequest (...queries) {
return fetchDeepContentfulData.fetchFlat(contentfulClient, ...queries.map(normalizeQuery))
}
Insert cell
contentfulClient = fetchDeepContentfulData.createClient({
space: spaceId,
accessToken
})
Insert cell
Insert cell
lodash = require('lodash')
Insert cell
fetchDeepContentfulData = require("https://bundle.run/fetch-deep-contentful-data@4.1.1")
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more