The Collections API allows you to create curated lists of items.
{
"id": "5df434f8031fdd45f669e39b42f2221a",
"name": "foo",
"num_items": 2,
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd",
"created_at": "2019-12-14T01:03:52.454906Z",
"updated_at": "2019-12-14T01:03:52.454906Z"
}
id
- (string) The collection’s unique identifiername
- (string) The name of the collectionnum_items
- (int) The number of items in the collectionuser_id
- (string) The user id of the collection’s ownercreated_at
- (string) The timestamp when the collection was createdupdated_at
- (string) The timestamp when the collection was last updated {
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"display_order": 1,
"added_at": "2019-12-16T14:50:11.186819Z"
}
collection_id
- (string) The collection to which this CollectionItem belongsitem_id
- (string) The ID of the itemdisplay_order
- (int) The order of this item in the collectionadded_at
- (string) The timestamp when this item was added to the collection{
"items": [
{
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"display_order": 1,
"added_at": "2019-12-16T14:50:11.186819Z"
}
],
"next_page": "NP-BAwEBBVRva2VuAf-CAAEDAQVMaW1pdAEEAAEGT2Zmc2V0AQQAAQZQYXJhbXMB_4QAAAAh_4MEAQERbWFwW3N0cmluZ11zdHJpbmcB_4QAAQwBDAAAB_-CAQIBAgA="
}
items
- ([]Item) An array of Item objectsnext_page
- (string) The token to retrieve a subsequent page of results from the Collection Read endpoint. If this is an empty string, there are no additional pages of results.{
"collection": {
"id": "5df434f8031fdd45f669e39b42f2221a",
"name": "foo",
"num_items": 2,
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd",
"created_at": "2019-12-14T01:03:52.454906Z",
"updated_at": "2019-12-14T01:03:52.454906Z"
},
"items": {
"items": [
{
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"display_order": 1,
"added_at": "2019-12-16T14:50:11.186819Z"
}
],
"next_page": "NP-BAwEBBVRva2VuAf-CAAEDAQVMaW1pdAEEAAEGT2Zmc2V0AQQAAQZQYXJhbXMB_4QAAAAh_4MEAQERbWFwW3N0cmluZ11zdHJpbmcB_4QAAQwBDAAAB_-CAQIBAgA="
}
}
collection
- The Collection modelitems
- An ItemsList model{
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"collection_id": "5df434f8031fdd45f669e39b42f2221a"
}
item_id
: (string) The unique id of an itemcollection_id
: (string) The unique id of a collection{
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"error": "some error string"
}
item_id
: (string) The unique id of an itemcollection_id
: (string) The unique id of a collectionerror
: (string) An error messageGET /api/data/v3/collections?limit={limit}&limit-items={limit-items}&page-token={page-token}
limit
- (int) Optional. Number of collections to return. Min: 1. Max: 100. Default: 20.limit-items
- (int) Optional. Number of items per collection to return. Min: 1. Max: 1000. Default: 20.page-token
- (string) Optional. The token to retrieve another page of results.{
"collections": [
{
"collection": {
"id": "5df434f8031fdd45f669e39b42f2221a",
"name": "foo",
"num_items": 2,
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd",
"created_at": "2019-12-14T01:03:52.454906Z",
"updated_at": "2019-12-14T01:03:52.454906Z"
},
"items": {
"items": [
{
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"display_order": 1,
"added_at": "2019-12-16T14:50:11.186819Z"
}
],
"next_page": "NP-BAwEBBVRva2VuAf-CAAEDAQVMaW1pdAEEAAEGT2Zmc2V0AQQAAQZQYXJhbXMB_4QAAAAh_4MEAQERbWFwW3N0cmluZ11zdHJpbmcB_4QAAQwBDAAAB_-CAQIBAgA="
}
},
...
],
"next_page": "{next page token}",
"previous_page": "{previous page token}"
}
collections
- []CollectionWithItems A list of CollectionWithItems objects.next_page
- (string) The token to retrieve a subsequent page of results. If this is an empty string, there are no additional pages of results.previous_page
- (string) The token to retrieve the previous page of results. If this is an empty string, you are on the first page of results.Get the details for a collection, including the list of items
GET /api/data/v3/collections/{id}?limit={limit}&page-token={page-token}
{id}
- (string) The ID of the Collection{limit}
- (string) The number of items to include in the response{page-token}
- (string) Optional. The token to retrieve another page of results.{
"collection": {
"id": "5df434f8031fdd45f669e39b42f2221a",
"name": "foo",
"num_items": 2,
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd",
"created_at": "2019-12-14T01:03:52.454906Z",
"updated_at": "2019-12-14T01:03:52.454906Z"
},
"items": [
{
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "5b5e5a5eb6a8341d1b13871fdf8c3fef",
"display_order": 1,
"added_at": "2019-12-16T14:50:11.186819Z"
},
{
"collection_id": "5df434f8031fdd45f669e39b42f2221a",
"item_id": "6daabbd507f73881bcf571f0424e5892",
"display_order": 3,
"added_at": "2019-12-16T15:54:23.807625Z"
}
],
"next_page": "{next page token}",
"previous_page": "{previous page token}"
}
The API responds with a status code of 200 and a CollectionWithItems model.
Add a new collection
POST /api/data/v3/collections
{
"name": "Awesome action movies"
}
name
- (string) Required. Human-readable name of the collection{
"id": "5dfbc0ce85d2e2047a209fcf7a8f6fe3",
"name": "Awesome action movies",
"num_items": 0,
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd",
"created_at": "2019-12-19T18:26:22.525319Z",
"updated_at": "2019-12-19T18:26:22.525319Z"
}
The API will respond with a 201 status code and a Collection model.
PUT /api/data/v3/collections/{id}
{
"name": "new collection title"
}
The server will respond with a 200 status code and a Collection model.
DELETE /api/data/v3/collections/{id}
id
- (string) unique ID of the collection to deleteExpect a response status code of 204
Add one or more items to a collection
POST /api/data/v3/collections/{id}/items
{
"items": [
"1a9db061775230e03d5cdc98e4b5d218",
"6daabbd507f73881bcf571f0424e5892"
]
}
id
- (string) unique ID of the collection to add the items toitems
- ([]string) A list of item ids to add to the collectionDELETE /api/data/v3/collections/{id}/items
{
"items": [
"1a9db061775230e03d5cdc98e4b5d218",
"6daabbd507f73881bcf571f0424e5892"
]
}
id
- (string) unique ID of the collection to remove the items fromitems
- ([]string) A list of item ids to remove from the collectionSend an array of item IDs in the order you would like them to appear. All item IDs from the collection must be specified.
POST /api/data/v3/collections/{id}/reorder
{
"item_ids": [
"5789031d7d551417c16891d475429de3",
"43na3125b9f5421e1cb5702deb8d45e",
"5702031d7d551417c16891d475429ab5"
]
}
items
- ([]string) List of item ids belonging to the collection in the order you want them to appear in the collection. The id of every item in the collection must be specified.Create a copy (including items) of a collection
POST /api/data/v3/collections/{id}/clone
{
"name": "my cloned comp"
}
id
- (string) unique ID of the collection to clone.name
- (string) what to name the cloned collection.Retrieve a list of collections to which a particular item belongs. Only returns collections that the user initiating the request has access to.
GET /api/data/v3/items/{id}/collections?limit={limit}&page-token={page-token}
{id}
- (string) The ID of the Collection{limit}
- (string) The number of items to include in the response{page-token}
- (string) Optional. The token to retrieve another page of results.{
"collections": [
{
"created_at": "2019-12-14T01:03:52.454906Z",
"id": "5df434f8031fdd45f669e39b42f2221a",
"name": "foo",
"num_items": 2,
"updated_at": "2019-12-14T01:03:52.454906Z",
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd"
},
{
"created_at": "2019-12-17T18:46:53.454604Z",
"id": "jive",
"name": "fooballs",
"num_items": 2,
"updated_at": "2019-12-17T18:46:53.454604Z",
"user_id": "5dc1d37d24e702ea2658b6ae65f18bfd"
}
],
"next_page": "{next page token}",
"previous_page": "{previous page token}"
}
collections
- ([]Collection) A list of Collection modelsnext_page
- (string) The token to retrieve a subsequent page of results. If this is an empty string, there are no additional pages of results.previous_page
- (string) The token to retrieve the previous page of results. If this is an empty string, you are on the first page of results.This endpoint allows you to associate one or more items to one or more collections. Up to 1000 items and 1000 collections can be submitted at a time.
POST /api/data/v3/collections/bulk
{
"items": [
"item1",
"item2"
],
"collections": [
"5df434f8031fdd45f669e39b42f2221a",
"5df434f8031fdd45f669e39bcdb74679"
]
}
{
"successes": [
{
"item_id": "item1",
"collection_id": "5df434f8031fdd45f669e39b42f2221a"
},
{
"item_id": "item2",
"collection_id": "5df434f8031fdd45f669e39b42f2221a"
}
],
"failures": [
{
"item_id": "item1",
"collection_id": "5df434f8031fdd45f669e39bcdb74679",
"error": "some error"
},
{
"item_id": "item2",
"collection_id": "5df434f8031fdd45f669e39bcdb74679",
"error": "some error"
}
]
}
successes
- ([]BulkSuccess) An array of BulkSuccess modelsfailures
- ([]BulkFailure) An array of BulkFailure modelsThis endpoint allows you to remove one or more items from one or more collections. Up to 1000 items and 1000 collections can be submitted at a time.
DELETE /api/data/v3/collections/bulk
{
"items": [
"item1",
"item2"
],
"collections": [
"5df434f8031fdd45f669e39b42f2221a",
"5df434f8031fdd45f669e39bcdb74679"
]
}
{
"successes": [
{
"item_id": "item1",
"collection_id": "5df434f8031fdd45f669e39b42f2221a"
},
{
"item_id": "item2",
"collection_id": "5df434f8031fdd45f669e39b42f2221a"
}
],
"failures": [
{
"item_id": "item1",
"collection_id": "5df434f8031fdd45f669e39bcdb74679",
"error": "some error"
},
{
"item_id": "item2",
"collection_id": "5df434f8031fdd45f669e39bcdb74679",
"error": "some error"
}
]
}
successes
- ([]BulkSuccess) An array of BulkSuccess modelsfailures
- ([]BulkFailure) An array of BulkFailure modelsThis documentation is generated from the latest version of GrayMeta Platform. For documentation relevant to your own deployed version, please use the documentation inside the application.
© 2021 GrayMeta, Inc.