Create a Collection

Last updated 7 months ago

post
Create a Collection

https://api.moltin.com
/v2/collections
Request
Response
Headers
Authorization
required
string
The Bearer token to grant access to the API.
Body Parameters
type
required
string
Represents the type of object being returned.
name
required
string
The name of the collection.
slug
required
string
A unique slug identifier for the collection.
description
optional
string
Any description for this collection.
status
optional
string
live, or draft depending on the collection status. (defaults to draft)
200: OK
{
"data": {
"id": "a276571c-321e-4c48-af2a-5a3895394b08",
"type": "collection",
"status": "live",
"name": "Winter Season",
"slug": "winter-season",
"description": "Our Winter Season is now live!",
"relationships": {}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/collections \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "collection",
"name": "Winter Season",
"slug": "winter-season",
"description": "Our Winter Season is now live!",
"status": "live"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'XXXX'
})
var collection = {
name: "Winter Season",
slug: "winter-season",
description: "Our Winter Season is now live!",
status: "live"
}
Moltin.Collections.Create(collection).then((response) => {
// Do something
});