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

Kicking off the Storylines Tour 2023 in New York City to showcase the power of storytelling in an increasingly complex, dynamic, and multichannel landscape.
News

Storylines Tour NYC: The page-turning event, wrapped

May 10, 2023

A bumper crop of content in the newsletter this month; two JavaScript starter guides for Remix and React, and we sponsored and spoke at various events.
News

Engineering interview, new JavaScript starters, and fun webinars

September 13, 2022

At Storylines London, we learned how brands like Formula 1, Marks & Spencer, Unmind and many more engage their customers with story-driven experiences.
News

Storylines Tour London: Talking about the ties that bind and the stories that captivate

July 5, 2023

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