Was this page helpful?

Extension management with the Contentful CLI

These commands will help you manage extensions in Contentful.

Requirements

List available commands and their description

contentful extension --help

Create a new extension

contentful extension create --space-id xxx --id test --name "Test Extension" --field-types Symbol --src https://new.extension

Create an extension using srcdoc with automatically assigned ID and two field types:

contentful extension create --space-id xxx --field-types Symbol --field-types Text --srcdoc ./bundle.html

When using srcdoc property, an extension is considered internally hosted. A file being pointed by the srcdoc property will be loaded and uploaded as a string to Contentful. All local dependencies have to be manually inlined into the file. The command line tool does not take care of link resolving and inlining of referenced local resources. The maximal size of a file used with the srcdoc property is 200kB.

Create an extension using ./extension.json descriptor file and provide installation parameter:

Examples of extension.json files and extensions in general can be found here.

contentful extension create --space-id xxx --installation-parameters '{"devMode": true}'

Get a list of all available extensions

Lists all available extensions from a space.

contentful extension list --space-id xxx

The output should look similar to this:

┌────────────────┬──────────────┬──────────────┐
│ Extension Name │ Extension ID │ Version      │
├────────────────┼──────────────┼──────────────┤
│ Test           │ test         │ 3            │
└────────────────┴──────────────┴──────────────┘

Delete an extension

Deletes an extension from a space.

contentful extension delete --space-id xxx --id test

The output should look similar to this:

Successfully deleted extension with ID test

Get an extension

Prints information about the requested extension.

contentful extension get --space-id xxx --id test

The output should look similar to this:

┌─────────────┬───────────────────────────┐
│ Property    │ Value                     │
├─────────────┼───────────────────────────┤
│ ID          │ test                      │
├─────────────┼───────────────────────────┤
│ Name        │ Test Extension            │
├─────────────┼───────────────────────────┤
│ Field types │ Symbol                    │
├─────────────┼───────────────────────────┤
│ Src         │ https://awesome.extension │
├─────────────┼───────────────────────────┤
│ Version     │ 1                         │
└─────────────┴───────────────────────────┘

Update an extension

Update an extension without providing its current version:

contentful extension update --space-id xxx --id test --name "Test Extension" --field-types Symbol --src https://new.extension --force

Update an extension using srcdoc and two field types:

contentful extension update --space-id xxx --id test --field-types Symbol --field-types Text --srcdoc ./bundle.html --version 2

Update an extension using ./extension.json descriptor file and provide installation parameter:

contentful extension update --space-id xxx --installation-parameters '{"devMode": true}' --force

Next steps

Not what you’re looking for? Try our FAQ.