Create a Collection using the CLI
This document outlines how to create new collections, retrieve their collection ID and access token to access your content from a website.
Pantheon Content Publisher Collections (formerly Sites) require 2 variables to be set in order to operate. These variables can be set during the starter kit setup and this guide documents their initialization and usage. Note: Collections used to be named “pcc site”, this will be updated.
The PCC_SITE_ID variable uniquely identifies the site to which documents are published. It can be set through the CLI as follows, entering the domain of your site. If you are using a development domain, enter that now and you can change it later through the PCC add-on.
pcc site create --url <site-url>
✔ Successfully created the site with given details.
Id: xXXXXXXXXXXX
Note that the URL needs to be in the form of https://mydomain.com. Don’t worry if you don’t already have one. It can always be edited later.
Copy the ID that is returned for later use.
The PCC_TOKEN variable allows PCC to verify the authenticity of any API calls made by the site. It is set as follows.
pcc token create
✔ Successfully created token for your user.
Token: xxxxx-xxxxx-xxxx-xxxx-xxxxxx
Copy the token that is returned for later use.
You can now use the created variables as per your normal development process. Typically setting them in a .env.local file as shown below for local development or setting them in the environment variables of your Front End Site.
PCC_SITE_ID=xXXXXXXXXXXX
PCC_TOKEN=xxxxx-xxxxx-xxxx-xxxx-xxxxxx