Flows

1
Last updated 8 months ago

A Flow describes a collection of Fields. It is named after the internal entity type you wish to associate it with. For example a Flow with a slug of products will be applied to all Product responses in your store.

The flow object

Attribute

Type

Description

id

string

The unique identifier for this flow.

type

string

Represents the type of object being returned

name

string

The name of the flow

slug

string

A unique slug identifier for the flow

description

string

Any description for this flow

enabled

bool

true if enabled, false if not

get
Get a Flow

https://api.moltin.com
/v2/flows/:id
Request
Response
Path Parameters
id
required
string
The ID for the flow you are requesting
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
{
"data": {
"id": "38ba1451-efa4-4361-9ca6-3fb646490f37",
"type": "flow",
"name": "extraFieldRenamed",
"slug": "products",
"description": "Extends the default product object",
"enabled": true,
"links": {
"self": "https://api.moltin.com/v2/flows/38ba1451-efa4-4361-9ca6-3fb646490f37"
},
"relationships": {},
"meta": {
"timestamps": {
"created_at": "2018-05-10T01:41:36.009Z",
"updated_at": "2018-05-10T15:27:26.241Z"
}
}
}
}
cURL
JavaScript SDK
curl https://api.moltin.com/v2/flows/:id \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const flowId = 'XXXX';
Moltin.Flows.Get(flowId).then(flows => {
// Do something
});

post
Create a Flow

https://api.moltin.com
/v2/flows
Request
Response
Headers
Authorization
required
string
The Bearer token to grant access to the API.
Body Parameters
enabled
required
boolean
true if enabled, false if not
description
required
string
Any description for this flow
slug
required
string
A unique slug identifier for the flow
name
required
string
The name of the flow
type
required
string
Represents the type of object being returned.
200: OK
{
"data": {
"id": "6d320b42-237d-4474-8452-d49f884d4ae1",
"type": "flow",
"name": "Products-1",
"slug": "products-1",
"description": "Extends the default product object",
"enabled": true,
"links": {
"self": "https://api.moltin.com/v2/flows/6d320b42-237d-4474-8452-d49f884d4ae1"
},
"relationships": {},
"meta": {
"timestamps": {
"created_at": "2018-05-10T18:04:26.623Z",
"updated_at": "2018-05-10T18:04:26.623Z"
}
}
}
}
cURL
JavaScript SDK
curl -X POST "https://api.moltin.com/v2/flows" \
-H "Authorization: XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "flow",
"name": "Products",
"slug": "products",
"description": "Extends the default product object",
"enabled": true
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const data = {
name: 'Products flow',
slug: 'products',
description: 'Extends the default product object',
enabled: true
}
Moltin.Flows.Create(data).then(flow => {
// Do something
});

put
Update a Flow

https://api.moltin.com
/v2/flows/:id
Request
Response
Path Parameters
id
required
string
The ID for the flow you are changing.
Headers
Authorization
required
string
The Bearer token to grant access to the API.
Body Parameters
id
required
string
The ID of the flow you're requesting
type
required
string
Represents the type of object being returned
name
optional
string
The name of the flow
slug
optional
string
A unique slug identifier for this flow
description
optional
string
Any description for this flow
enabled
optional
string
true if enabled false if not
200: OK
{
"data": {
"id": "6d320b42-237d-4474-8452-d49f884d4ae1",
"type": "flow",
"name": "extraFieldRenamed",
"slug": "products-1",
"description": "Extends the default product object",
"enabled": true,
"links": {
"self": "https://api.moltin.com/v2/flows/6d320b42-237d-4474-8452-d49f884d4ae1"
},
"relationships": {},
"meta": {
"timestamps": {
"created_at": "2018-05-10T18:04:26.623Z",
"updated_at": "2018-05-10T18:11:47.469Z"
}
}
}
}
cURL
JavaScript SDK
curl -X POST "https://api.moltin.com/v2/flows/:id" \
-H "Authorization: XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"id": "{FLOW_ID}",
"type": "flow",
"name": "Categories",
"slug": "categories",
"description": "Extends the default category object",
"enabled": true
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const flowId = 'XXX'
const data = {
name: 'Categories',
slug: 'categories',
description: 'Extends the default category object'
}
Moltin.Flows.Update(flowId, data).then(flow => {
// Do something
});

delete
Delete a Flow

https://api.moltin.com
/v2/flows/:id
Request
Response
Path Parameters
id
required
string
The ID for the field you are requesting to be deleted
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
cURL
JavaScript SDK
curl -X DELETE https://api.moltin.com/v2/flows/:id \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const flowId = 'XXX'
Moltin.Flows.Delete(flowId).then(flow => {
// Do something
});