Integrations / Contentful
Contentful
Headless CMS: list spaces, content types and entries, read one entry, and create, update and publish entries.
8 actions
API key
5 read3 write
Calls api.contentful.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "contentful" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
This toolkit uses a single credential and requests no scopes.
Actions
Create entrywritecontentful.create_entryCreate a new draft entry of a content type with an auto-generated id. Fields are keyed by field id, then locale. The entry is not published until you publish it.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
content_type_id | string | Required | Id of the content type, e.g. blogPost |
fields | object | Required | Field values keyed by field id then locale, e.g. {"title": {"en-US": "Hello"}} |
await setu.execute({
userId: "user_1",
action: "contentful.create_entry",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>",
"content_type_id": "<content_type_id>",
"fields": {}
},
});Get entryreadcontentful.get_entryGet one entry with all its fields (keyed by locale) and its version, content type and timestamps.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
entry_id | string | Required | Entry id |
await setu.execute({
userId: "user_1",
action: "contentful.get_entry",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>",
"entry_id": "<entry_id>"
},
});Get spacereadcontentful.get_spaceGet one Contentful space's name, id and version.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
await setu.execute({
userId: "user_1",
action: "contentful.get_space",
input: {
"space_id": "<space_id>"
},
});List content typesreadcontentful.list_content_typesList the content types (models) of a space environment: id and name. Needed to filter entries by type.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
limit | integer | Optional | Maximum results |
skip | integer | Optional | Results to skip |
await setu.execute({
userId: "user_1",
action: "contentful.list_content_types",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>"
},
});List entriesreadcontentful.list_entriesList entries of a space environment, optionally only one content type or a full-text query. Fields are keyed by locale.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
content_type | string | Optional | Content type id to filter by |
query | string | Optional | Full-text search |
limit | integer | Optional | Maximum results |
skip | integer | Optional | Results to skip |
await setu.execute({
userId: "user_1",
action: "contentful.list_entries",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>"
},
});List spacesreadcontentful.list_spacesList the Contentful spaces the token can access: id and name. Space ids are needed for entries.
| Input | Type | Description | |
|---|---|---|---|
limit | integer | Optional | Maximum spaces |
skip | integer | Optional | Spaces to skip |
query | string | Optional | Exact space id or partial name |
await setu.execute({
userId: "user_1",
action: "contentful.list_spaces",
input: {},
});Publish entrywritecontentful.publish_entryPublish an entry so it appears in the delivery API. Needs the entry's current version.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
entry_id | string | Required | Entry id |
version | integer | Required | The entry's current version (sys.version) |
await setu.execute({
userId: "user_1",
action: "contentful.publish_entry",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>",
"entry_id": "<entry_id>",
"version": 1
},
});Update entrywritecontentful.update_entryReplace an entry's fields. Send ALL fields you want to keep, since the body is the entry's full field set (read it with get entry first). Needs the entry's current version to guard against concurrent edits.
| Input | Type | Description | |
|---|---|---|---|
space_id | string | Required | Space id |
environment_id | string | Required | Environment id, usually master |
entry_id | string | Required | Entry id |
version | integer | Required | The entry's current version (sys.version from get entry) |
fields | object | Required | All field values keyed by field id then locale |
await setu.execute({
userId: "user_1",
action: "contentful.update_entry",
input: {
"space_id": "<space_id>",
"environment_id": "<environment_id>",
"entry_id": "<entry_id>",
"version": 1,
"fields": {}
},
});