Entries
Entries hold the pieces of data collected within the Fields.
| | |
| | The unique identifier for this entry |
| | Represents the type of object being returned |
| | There can be a :fieldSlug attribute for each field attached to the flow. The type will depend on the field type. |
If your flow has more than one field related to it, you will see multiple field slugs.
Get all Entries
GET
https://api.moltin.com/v2/flows/:slug/entries
Path Parameters
Name | Type | Description |
---|
| | The slug for the flow you are requesting entries for |
Name | Type | Description |
---|
| | The Bearer token to grant access to the API |
{
"data": [
{
"id": "ce1f0b19-23c3-487b-aa2a-552b77abdf0c",
"type": "entry",
"brand-image": "https://s3-eu-west-1.amazonaws.com/bkt-svc-files-cmty-api-moltin-com/e8c53cb0-120d-4ea5-8941-ce74dec06038/61118f21-14a2-466c-a84b-c30b1f900cf9.png",
"meta": {
"timestamps": {
"created_at": "2018-06-05T20:58:25.596Z",
"updated_at": "2018-06-05T20:58:25.596Z"
}
},
"links": {
"self": "https://api.moltin.com/v2/flows/brands/entries/ce1f0b19-23c3-487b-aa2a-552b77abdf0c"
}
},
{
"id": "a5fcf6bc-233f-44d7-a3b0-0961eed3df9d",
"type": "entry",
"brand-image": "someimage for brand x",
"meta": {
"timestamps": {
"created_at": "2018-06-06T14:48:59.006Z",
"updated_at": "2018-06-06T14:48:59.006Z"
}
},
"links": {
"self": "https://api.moltin.com/v2/flows/brands/entries/a5fcf6bc-233f-44d7-a3b0-0961eed3df9d"
}
}
],
"links": {
"current": "https://api.moltin.com/v2/flows/products/entries?page[limit]=2&page[offset]=0",
"first": "https://api.moltin.com/v2/flows/products/entries?page[limit]=2&page[offset]=0",
"last": "https://api.moltin.com/v2/flows/products/entries?page[limit]=2&page[offset]=36",
"previous": null,
"next": "https://api.moltin.com/v2/flows/products/entries?page[limit]=2&page[offset]=2"
},
"meta": {
"page": {
"limit": 2,
"offset": 0,
"current": 1,
"total": 19
},
"results": {
"total": 37
}
}
}
You can use pagination with this resource. See: Settings for details.
curl https://api.moltin.com/v2/flows/:slug/entries \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const slug = 'XXXX'
Moltin.Flows.GetEntries(slug).then(entries => {
// Do something
})
Get an Entry
GET
https://api.moltin.com/v2/flows/:slug/entries/:id
Path Parameters
Name | Type | Description |
---|
| | The ID of the entry you are requesting |
| | The slug for the flow you are requesting an entry for |
Name | Type | Description |
---|
| | The Bearer token to grant access to the API |
{
"data": {
"id": "4abb8316-d0a2-4c91-bf29-4d19ba932227",
"type": "entry",
"meta": {
"timestamps": {
"created_at": "2018-05-10T15:28:59.192Z",
"updated_at": "2018-05-10T15:28:59.192Z"
}
},
"links": {
"self": "https://api.moltin.com/v2/flows/products/entries/4abb8316-d0a2-4c91-bf29-4d19ba932227"
}
}
}
curl https://api.moltin.com/v2/flows/:slug/entries/:id \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const slug = 'XXXX'
const entryId = 'XXXX'
Moltin.Flows.GetEntry(slug, entryId).then(entry => {
// Do something
})
Create an Entry
POST
https://api.moltin.com/v2/flows/:slug/entries
Path Parameters
Name | Type | Description |
---|
| | The slug for the Flow you are requesting an Entry for |
Name | Type | Description |
---|
| | The Bearer token to grant access to the API |
Request Body
Name | Type | Description |
---|
| | This will always be entry |
| | The field slug for each field on this flow along with the corresponding value for this entry. |
{
"data": {
"id": "06de90b0-5426-4f61-bcd2-fcdeab40b806",
"type": "flow",
"name": "Brands",
"slug": "Brands",
"description": "Extends the default brand object",
"enabled": true,
"links": {
"self": "https://api.moltin.com/v2/flows/06de90b0-5426-4f61-bcd2-fcdeab40b806"
},
"relationships": {},
"meta": {
"timestamps": {
"created_at": "2018-06-06T14:56:20.860Z",
"updated_at": "2018-06-06T14:56:20.860Z"
}
}
}
}
curl -X POST https://api.moltin.com/v2/flows/:flowSlug/entries \
-H "Authorization: XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"type": "entry",
"{FIELD_SLUG}": "a value",
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const flowSlug = 'XXXX'
const data = {
"{FIELD_SLUG}": "A value"
}
Moltin.Flows.CreateEntry(flowSlug, data).then(entry => {
// Do something
})
Update an entry
PUT
https://api.moltin.com/v2/flows/:slug/entries/:id
Path Parameters
Name | Type | Description |
---|
| | The slug for the Flow you are requesting an entry for |
| | The ID of the entry you are updating |
Name | Type | Description |
---|
| | The Bearer token to grant access to the API |
Request Body
Name | Type | Description |
---|
| | This will always be entry |
| | The field slug for each field in this flow along with the corresponding value for this entry |
| | |
{
"data": {
"id": "03224af8-da41-4761-99fb-a125fa81ed99",
"type": "entry",
"brand-image": "someimage new things",
"meta": {
"timestamps": {
"created_at": "2018-06-06T14:42:39.312Z",
"updated_at": "2018-06-06T14:42:39.312Z"
}
},
"links": {
"self": "https://api.moltin.com/v2/flows/brands/entries/03224af8-da41-4761-99fb-a125fa81ed99"
}
}
}
curl -X PUT https://api.moltin.com/v2/flows/:flowSlug/entries/:entryId \
-H "Authorization: XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"id": "{ENTRY_ID}",
"type": "entry",
"{FIELD_SLUG}": "a new value",
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const flowSlug = 'XXXX'
const entryId = 'XXXX'
const data = {
"{FIELD_SLUG}": "A new value"
}
Moltin.Flows.UpdateEntry(flowSlug, entryId, data).then(entry => {
// Do something
})
You can have multiple {FIELD_SLUG}
values in the request body if they are related to the flow.
Delete an Entry
DELETE
https://api.moltin.com/v2/flows/:slug/entries/:id
Path Parameters
Name | Type | Description |
---|
| | The ID of the entry you are requesting to delete |
| | The slug for the Flows you are requesting entries for |
Name | Type | Description |
---|
| | The Bearer token to grant access to the
API |
curl -X DELETE https://api.moltin.com/v2/flows/:flowSlug/entries/:entryId \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const flowSlug = 'XXXX'
const entryId = 'XXXX'
Moltin.Flows.DeleteEntry(flowSlug, entryId).then(entry => {
// Do something
})