Create a Brand

Last updated last month

post
Create a Brand

https://api.moltin.com
/v2/brands
Request
Response
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
status
optional
string
live or draft depending on the status. Defaults to draft
description
optional
string
Any description for this brand
slug
required
string
A unique slug identifier for the brand
name
required
string
The name of the brand
type
required
string
This represents the type of object being returned
201: Created
{
"data": {
"id": "06e510ae-4ddd-4150-a721-561ca5c4ce31",
"type": "brand",
"status": "live",
"name": "Cool Clothing",
"slug": "cool-clothing",
"description": "Cool clothing make cool clothes!",
"relationships": {}
}
}
422: Unprocessable Entity
In this example we skip passing name to fail validation
{
"errors": [
{
"title": "Failed Validation",
"detail": "The data.name field is required."
}
]
}
cURL
JavaScript SDK
Moltin Request
curl -X POST https://api.moltin.com/v2/brands \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "brand",
"name": "Cool Clothing",
"slug": "cool-clothing",
"description": "Cool clothing make cool clothes!",
"status": "live"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const id = 'XXXX'
const brand = {
name: 'Cool Clothing',
slug: 'cool-clothing',
description: 'Cool clothing make cool clothes.',
status: 'live'
}
Moltin.Brands.Create(id, brand).then(brand => {
// Do something
})
const { createClient } = require('@moltin/request')
const client = new createClient({
client_id: 'X',
client_secret: 'X'
})
const data = {
type: 'brand',
name: 'Cool Clothing',
slug: 'cool-clothing',
description: 'Cool clothing make cool clothes.',
status: 'live'
}
client
.post('brands', data)
.then(brand => {
// Do something...
})
.catch(console.error)