The Contentstack Postman Collection is a set of preconfigured requests that will make it easy for you to get started with the Contentstack APIs and try out our API requests through the popular Postman REST client.
To use the Contentstack Postman Collection, you will need the latest Postman app installed on your device. Postman is available for Windows (x32), Windows (x64), Mac, and Linux environments.
Contentstack Postman collection covers all the Content Delivery, and Content Management, and GraphQL Content Delivery API endpoints for Contentstack.
Click on the respective Run in Postman button to automatically import the collection along with the respective environment file into your Postman app. (Or, you can download the JSON file of the respective Postman Collection and import the file in Postman.)
CDA Postman Collection
CMA Postman Collection
Note: For Windows, downloading the Content Management API collection doesn't download the environment automatically due to the larger size of the environment file. Consequently, Windows users need to download the respective environment file manually and import it in their Postman environment.
GraphQL CDA Postman Collection
Though clicking on any of the above Run in Postman buttons will automatically import the collection along with the respective environment, you can also download and import the environments manually:
-
Content Management API - Environment: North America, Europe, Azure - North America
-
Content Delivery API - Environment: North America, Europe, Azure - North America
-
GraphQL API - Environment: North America, Europe, Azure - North America
Note: By default, the environment file for the “North America” region is imported. To import the environment file for the “Europe” region, you need to download the respective environment listed above and import the content into Postman.
As Contentstack releases new features and keeps adding API requests associated with the release, it’s better to use an updated version of Postman collection. To get an updated version of our Postman Collection, you can either re-import the collection by clicking the “Run in Postman” button mentioned above or by running this script.
To update the existing version of Contentstack’s Postman collection, perform the following steps:
-
You can either download this repository or clone it by running the following command in your terminal:
git clone https://github.com/contentstack/contentstack-postman-collections.git
-
Inside the terminal, run this command to go in postman folder:
cd contentstack-postman-collections -
Install necessary modules by running either
npm installornpm icommand in the terminal. -
Navigate to the .env file, and add your Postman’s API key and collections’ UID.
To get Postman’s API key, you need to log in or create a Postman account and get the API key. To learn how to create an API key, refer to the Postman’s API key generation article.
To get collections’ API Key, refer to the Get All Collections API request.
-
To pull or clone our latest postman collection, run
npm startin the terminal. This will clone our collections in the ".latest-collection" directory.Note: If this command does not work in any powershell, try switching to Bash terminal by following the steps discussed in this section.
-
Run the following command to update your postman collection:
#For updating whole collection: npm run updateAll #For updating single collection: npm run update <collection_name>
Specify the name of collection in place of <collection_name>. Type cda for “Content Delivery API”, cma for “Content Management API”, and graphql for “GraphQL Content Delivery API”.
-
While the above steps will update your postman collection, you still need to download and import the environment file manually.
Contentstack recommends using environments instead of global or collection variables. For ease of use, when you download a collection, you download the respective environment too.
Here are certain variables that you need to update accordingly.
|
Variable |
Description |
Example |
|
{{base_url}} |
Enter the “North America” endpoint |
api.contentstack.io cdn.contentstack.io graphql.contentstack.com |
|
Enter the “Europe” endpoint |
eu-api.contentstack.com eu-cdn.contentstack.com eu-graphql.contentstack.com |
|
|
Enter the “Azure - North America” endpoint |
azure-na-api.contentstack.com azure-na-cdn.contentstack.com azure-na-graphql.contentstack.com |
Once you download the Postman app and download the latest collection, perform the following steps:
- Make sure to select the appropriate API environment on the top right.
- Add your credentials and other required environment variables.
- [For CMA Users only] If you are using Postman Collection for Content Management API requests, run the User Session Authentication request. Your authtoken will be automatically stored in a cookie. To avoid this, we recommend you to whitelist your API domain.
- Make the API Requests that you need.
For more details refer to our documentation.
We periodically update our Postman Collection. So, you may need to download it from time to time to stay up to date with the latest changes.
Content Delivery API Postman Collection