Update a Collection

get
Update by ID

https://api.moltin.com/v2/collections/:id
Request
Response
Path Parameters
id
required
string
The ID for the collection to update
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
optional
string
The name of the collection
slug
optional
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
200: OK
{
"data": {
"id": "645f97aa-ae63-4ee9-9259-062e570ba064",
"type": "collection",
"status": "draft",
"name": "Collection #1 Updated",
"slug": "collection-1-update",
"description": "First collection updated",
"meta": {
"timestamps": {
"created_at": "2018-05-10T14:23:18+00:00",
"updated_at": "2018-05-10T14:23:18+00:00"
}
},
"relationships": {}
}
}
cURL
JavaScript SDK
curl -X PUT https://api.moltin.com/v2/collections/:id \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "collection",
"id": "645f97aa-ae63-4ee9-9259-062e570ba064",
"name": "Collection #1 Updated",
"slug": "collection-1-update",
"description": "First collection updated",
"status": "live"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const collectionId = 'xxxx'
const collection = {
name: "Collection #1 Updated",
slug: "collection-1-update",
description: "First collection updated",
status: "live"
}
Moltin.Collections.Update(collectionId, collection).then(collection => {
// Do something
})