Discover our new CLI tool, your automation friend

CLI-Tool
Published
July 19, 2017
Category

News

We have created a CLI tool to make automation easier. You can use the tool to automate tasks like managing your delivery access tokens and creating new spaces. This is an early release and we'll continuously be adding more features.

Installing the CLI tool

The CLI tool is installed using your favorite package manager:

####With npm
npm install -g contentful-cli

####With yarn
yarn global add contentful-cli

Run the contentful guide command

If you’re new to Contentful, a good way to get familiar with the CLI tool is to run the contentful guide command.

Contentful CLI tool contentful guide screenshot

Running contentful guide will walk you through the process of signing up for Contentful, log in to your new account and create a space with some sample content.

The contentful guide command will also make use of that sample content to build and boot up a local web app called the Contentful blog in five minutes as shown below:

Contentful CLI tool local web app screenshot

Use the CLI tool for automation

More experienced Contentful users can use the CLI tool in their automation workflow. To get an idea of what the tool can do for automation, just type in contentful -h

Contentful CLI tool contentful -h

Working with spaces

So let’s say that we want to automate the creation of new spaces. But before we create any new spaces, we want to list the spaces that already exist: contentful space list

The output would then be like so

Contentful CLI tool - Spaces before space creation

And if we want to create a new space, we type in: contentful space create --name 'TheTechblog'.

Run contentful space list again to verify that the new space was successfully created

Contentful CLI tool - Spaces after space creation

As you can see, the bottom row now contains the entry for the Space TheTechblog together with its Space id of qs2d35pk12sf.

Give us your feedback

While we’re excited to introduce you to one of our latest creations, the CLI tool is still in its early stages. This means we’ll be adding lots of features in the near future. Our top priority with this tool is to make your life easier. So to get things just right - we need your feedback.

If you have a feature request, or if you’ve found an intrusive bug, let us know by using the “Talk to us” feature in the WebApp. You can also give us your suggestions via our Slack community channel at contentful.com/slack - or by writing to devrel@contentful.com.

Summary

Our new CLI tool makes it possible to automate tasks that you previously had to use the WebApp for. Such tasks include managing access tokens as well as listing and creating new spaces. If you’re new to Contentful, you can use the CLI tool’s guide mode to build a sample Contentful-powered app in just a few minutes.

About the author

Don't miss the latest

Get updates in your inbox
Discover how to build better digital experiences with Contentful.
add-circle arrow-right remove style-two-pin-marker subtract-circle remove