Create a Category

post
Create a Category

https://api.moltin.com/v2/categories
Request
Response
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
type
required
string
Represents the type of the object being returned
name
required
string
The name of the category
slug
required
string
A unique slug identifier for the category
description
optional
string
Any description for this category
status
optional
string
live or draft depending on the category status. (defaults to draft)
201: Created
{
"data": {
"id": "9dd56fc2-5746-46a2-bdf6-fe396bb6b7af",
"type": "category",
"status": "live",
"name": "Clothing",
"slug": "clothing",
"description": "Browse our clothing line",
"relationships": {}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/categories \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "category",
"name": "Clothing",
"slug": "clothing",
"description": "Browse our clothing line",
"status": "live"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const category = {
name: 'Clothing',
slug: 'clothing',
description: 'Browse our clothing line',
status: 'live'
}
Moltin.Categories.Create(category).then(category => {
// Do something
})