Discover our new CLI tool, your automation friend

Published on July 19, 2017

CLI-Tool

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

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.

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

Robert Svensson

Robert Svensson

Technical Copywriter

Copywriter with a soft spot for German literature, American abstract expressionism and Swedish poetry

Related articles

Spring Launch continues to unlock the power of composable content by empowering organizations to connect, collaborate, and scale digital experiences.
News

There’s something for everyone in the Contentful Spring Launch

May 4, 2023

Black Friday and Cyber Monday 2024 broke all records for online shopping activity. Contentful shares stats on billions of API calls served this holiday season.
News

Contentful powers biggest shopping events of 2024: Billions of API calls on Black Friday and Cyber Monday

December 5, 2024

The Phrase Localization Platform for Contentful is now available in the Contentful Marketplace, helping your brand expand to new markets more effectively.
News

Integration Spotlight: Speak every customer’s language with Phrase Localization Platform

November 18, 2024

Contentful Logo 2.5 Dark

Ready to start building?

Put everything you learned into action. Create and publish your content with Contentful — no credit card required.

Get started