Contentful has separate APIs for different purposes.
If you want to obtain scheduling relationships such as publishing schedules from Contentful, use Scheduled Actions
in the Content Management API.
Content Management API
Contentful’s Content Management API (CMA) helps you manage content in your spaces | Authentication | API rate limits | Spaces | Environments | Content types
A JavaScript SDK is provided, so this article describes how to use it.
目次
Installing the JavaScript SDK
Install contentful-management.
npm install contentful-management
Obtaining environmental information
Obtain Contentful environmental information in advance.
<accessToken> | Generate Personal access tokens. https://app.contentful.com/account/profile/cma_tokens The official website is here. https://www.contentful.com/help/personal-access-tokens/ |
<spaceId> | Get the space id. Go to the space page and get it from the URL. https://app.contentful.com/spaces/<spaceId>/home |
<environtmentId> | get from Contentful Page > Settings > Environments |
Obtaining a list of schedules to be published
Specify scheduled in the sys.status to be specified to obtain the schedule to be published.
const contentful = require("contentful-management");
const client = contentful.createClient({
accessToken: <accessToken>,
});
const space = await client.getSpace(<spaceId>);
return space.getScheduledActions({
"environment.sys.id": <environmentId>,
"sys.status": "scheduled",
});
We recommend reading the GitHub as it contains information on how to use the system and how to retrieve the data.
GitHub – contentful/contentful-management.js: JavaScript library for Contentful’s Management API (no…
JavaScript library for Contentful’s Management API (node & browser) – contentful/contentful-management.js