Items Data and Properties¶
List All Item-Properties¶
- 
GETitems-properties/¶ Note
Authorized Roles: root, manager, backend, frontend
Get all item-properties for the current database.
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
properties (list-of-object) –
All properties
Inner fields
property_name (string) – [max-length: 64] Property name. Only alphanumeric characters, dots, underscores or hyphens are allowed. The names ‘item_id’ and ‘user_id’ are reserved
value_type (string) – [max-length: 10] Property type [see Property Types]
repeated (bool) – Whether the property has many values
metadata (json-value) – Metadata, unvalidated JSON
EXAMPLE RESPONSE¶{ "properties": [ { "property_name": "price", "value_type": "float32", "repeated": false, "metadata": {} }, { "property_name": "tags", "value_type": "unicode32", "repeated": true, "metadata": {} }, { "property_name": "genres", "value_type": "unicode16", "repeated": true, "metadata": {} } ] }
Create New Item-Property¶
- 
POSTitems-properties/¶ Note
Authorized Roles: root, manager, backend
Create a new item-property, identified by
property_name(case-insensitive).- Request JSON Object
 property_name (string) – [max-length: 64] Property name. Only alphanumeric characters, dots, underscores or hyphens are allowed. The names ‘item_id’ and ‘user_id’ are reserved
value_type (string) – [max-length: 10] Property type [see Property Types]
repeated (bool) – Optional. Whether the property has many values
metadata (json-value) – Optional. Metadata, unvalidated JSON
EXAMPLE QUERY BODY¶{ "property_name": "price", "value_type": "float32", "repeated": false, "metadata": {"flag": true} }
Errors:
DuplicatedError with error name
DUPLICATED_ITEM_PROPERTYif an item property with the same name already existsWrongData with error name
WRONG_DATA_TYPEifvalue_typeis invalid
Get One Item-Property¶
- 
GETitems-properties/<str:property_name>/¶ Note
Authorized Roles: root, manager, backend
Get one item-property given its
property_name.- Response JSON Object
 property_name (string) – [max-length: 64] Property name. Only alphanumeric characters, dots, underscores or hyphens are allowed. The names ‘item_id’ and ‘user_id’ are reserved
value_type (string) – [max-length: 10] Property type [see Property Types]
repeated (bool) – Optional. Whether the property has many values
metadata (json-value) – Optional. Metadata, unvalidated JSON
EXAMPLE RESPONSE¶{ "property_name": "price", "value_type": "float32", "repeated": false, "metadata": {} }
Errors:
NotFoundError with error name
ITEM_PROPERTY_NOT_FOUNDif the property name cannot be found
Delete Item-Property¶
- 
DELETEitems-properties/<str:property_name>/¶ Note
Authorized Roles: root, manager, backend
Delete an item-property given by its name
Errors:
NotFoundError with error name
ITEM_PROPERTY_NOT_FOUNDif the property name cannot be foundWrongData with error name
ITEM_PROPERTY_FOUND_IN_SCENARIOif the property is being used in a scenario
[Internal] Partial Update Item-Property¶
- 
PATCHitems-properties/<str:property_name>/¶ Note
Authorized Roles: root, manager, backend
Deep partial update of the item-property’s metadata.
- Request JSON Object
 metadata (json-value) – Optional. Metadata, unvalidated JSON
preserve (bool) – Optional. whether to use JSON_MERGE_PRESERVE instead of JSON_MERGE_PATCH
EXAMPLE QUERY BODY¶{ "metadata": {"new_flag": true} }
Errors:
NotFoundError with error name
ITEM_PROPERTY_NOT_FOUNDif the property name cannot be found
Get Properties of One Item¶
- 
GETitems/<str:item_id>/properties/¶ Note
Authorized Roles: root, manager, backend, frontend
Get property values of one item given its ID.
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
item (object) – Item data
EXAMPLE RESPONSE¶{ "item": { "item_id": "123e4567-e89b-12d3-a456-426614174000", "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"], "price": 9.99 } }
Errors:
NotFoundError with error name
ITEM_NOT_FOUNDif no item with the givenitem_idcan be found
Create or Replace Properties of One Item¶
- 
PUTitems/<str:item_id>/properties/¶ Note
Authorized Roles: root, manager, backend
Create property values for one item, or replace them if the
item_idalready exists.All property types need to be defined beforehand, see Items and Users Properties.
Note that
item_idcannot be a “null” or “falsy” value, such as empty string or0.- Request JSON Object
 item (object) – Item data
wait_for_completion (bool) – Optional. Default is
trueto wait for completion and respond with 200 OK. Set tofalseto respond immediately with 202 Accepted after validation, and process asynchronously in the background. The background process may take 30 seconds to start, and there is no way to get notified when the process is complete. No validation of items properties values is done beforehand, the background task may fail silently.
EXAMPLE QUERY BODY¶{ "item": { "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"], "price": 9.99 } }
Errors:
WrongData with error name
WRONG_DATA_TYPEif the properties are invalid
Partial Update Properties of One Item¶
- 
PATCHitems/<str:item_id>/properties/¶ Note
Authorized Roles: root, manager, backend
Partially update some property values of one item. The properties that are not listed in the request body will be left unchanged. The list of values given for repeated properties will replace (not append) the previous list of values.
Use the body parameter
create_if_missingto control whether an error should be returned or a new item should be created when theitem_iddoes not already exist.All property types need to be defined beforehand, see Items and Users Properties.
Note that
item_idcannot be a “null” or “falsy” value, such as empty string or0.- Request JSON Object
 item (object) – Item data
create_if_missing (bool) – Optional. Create item that does not exist
EXAMPLE QUERY BODY¶{ "item": { "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"], "price": 9.99 }, "create_if_missing": false }
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
item_created (bool) – Indicates if the item was created
item_modified (bool) – Indicates if the item was modified
EXAMPLE RESPONSE¶{ "item_created": true, "item_modified": false }
Errors:
WrongData with error name
WRONG_DATA_TYPEif the properties are invalidNotFoundError only when create_if_missing=False with error name
ITEM_NOT_FOUNDif no item with the givenitem_idcan be found
Delete Properties of One Item¶
- 
DELETEitems/<str:item_id>/properties/¶ Note
Authorized Roles: root, manager, backend
Delete the property values of one item given its ID. Ratings and interactions are not deleted.
This endpoint is not commonly used. Note that to stop recommending an item, it is preferable to perform a partial update on a
statusproperty (or equivalent), and filter out the unwanted item using Filtering on Item Property. This allows the recommendation model to keep learning patterns of the previously available item.This endpoint is typically used only after some developer mistake, when the property values of an item shouldn’t have been set.
Create or Replace Properties of Many Items in Bulk¶
- 
PUTitems-bulk/properties/¶ Note
Authorized Roles: root, manager, backend
Create property values for many items in bulk, or replace the ones for which the
item_idalready exist.All property types need to be defined beforehand, see Items and Users Properties.
Note that
item_idcannot be a “null” or “falsy” value, such as empty string or0.- Request JSON Object
 items (object-array) –
(additional fields may be present) Items values
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
items_m2m (list-of-object) –
Optional. Items repeated values in array-optimized many-to-many format for binary clients [see Repeated Values]
Inner fields
name (string) – [max-length: 64] M2M name
array (object-array) – M2M array
Inner fields
item_index (uint32) – Item index (0-based)
value_id (any) – M2M related object ID
wait_for_completion (bool) – Optional. Default is
trueto wait for completion and respond with 200 OK. Set tofalseto respond immediately with 202 Accepted after validation, and process asynchronously in the background. The background process may take 30 seconds to start, and there is no way to get notified when the process is complete. No validation of items properties values is done beforehand, the background task may fail silently.
EXAMPLE QUERY BODY (JSON client)¶{ "items": [ { "item_id": "123e4567-e89b-12d3-a456-426614174000", "price": 9.99, "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"] }, { "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "price": 4.49, "tags": ["family"], "genres": ["thriller"] } ], "wait_for_completion": true }
EXAMPLE QUERY BODY (array-optimized format for binary client)¶{ "items": [ { "item_id": "123e4567-e89b-12d3-a456-426614174000", "price": 9.99 }, { "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "price": 4.49 } ], "items_m2m": [ { "name": "tags", "array": [ {"item_index": 0, "value_id": "family"}, {"item_index": 0, "value_id": "sci-fi"}, {"item_index": 1, "value_id": "family"} ] }, { "name": "genres", "array": [ {"item_index": 0, "value_id": "drama"}, {"item_index": 0, "value_id": "comedy"}, {"item_index": 1, "value_id": "thriller"} ] } ] }
Note that we represent the array-optimized using JSON for readability, but you should use a binary array instead
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
n_created (int) – Number of items created (only when
wait_for_completion=true)n_modified (int) – Number of items modified (only when
wait_for_completion=true)ml_task_id (string) – Optional.
ml_new_itemsBackground Task ID. Only when items are created.
EXAMPLE RESPONSE¶{ "n_created": 10, "n_modified": 2, "ml_task_id": "4xBBB6qkqDbGdlyYRAjF" }
Errors:
WrongData with error name
WRONG_DATA_TYPEif the properties are invalidDuplicatedError with error name
DUPLICATED_ITEM_IDif anitem_idoccurs multiple times in the same request
List Properties of All Items in Bulk¶
- 
GETitems-bulk/properties/¶ Note
Authorized Roles: root, manager, backend
Get property values of multiple items by page. The response is paginated, you can control the response amount and offset using the query parameters
amtandcursor.Note that the array-optimized format
items_m2mfor repeated values is used only for binary clients. Otherwise (e.g. JSON client), the repeated values are formatted as lists in each individual items.- Query Parameters
 amt (int) – Optional. [max: 500] Maximum amount of items returned, by default is 300
cursor (string) – Optional. Pagination cursor, typically from the
next_cursorvalue from the previous responseproperties (list-of-string) – Optional. Names of properties to fetch (by default, all properties are fetched)
filters (list-of-object) –
Optional. Filter on item properties [see Filtering on Item Property]
Inner fields
property_name (string) – Item-property name
op (enum) – choices (case insensitive): [
eq,lt,lte,gt,gte,in,empty,notempty,neq,notin,ftsearch] Filter Operatorvalue (json-value) – Filter Value
EXAMPLE QUERY PARAMS¶?amt=100&cursor=Q21vU1pHb1FjSEp...
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
items (object-array) –
(additional fields may be present) Items values
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
items_m2m (list-of-object) –
Items repeated values in array-optimized many-to-many format for binary clients [see Repeated Values]
Inner fields
name (string) – [max-length: 64] M2M name
array (object-array) – M2M array
Inner fields
item_index (uint32) – Item index (0-based)
value_id (any) – M2M related object ID
has_next (bool) – Indicates whether or not there are more items to request
next_cursor (string) – Pagination cursor to use in next request to get more items
EXAMPLE RESPONSE (JSON client)¶{ "items": [ { "item_id": "123e4567-e89b-12d3-a456-426614174000", "price": 9.99, "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"] }, { "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "price": 4.49, "tags": ["family"], "genres": ["thriller"] } ], "has_next": true, "next_cursor": "Q21vU1pHb1FjSEp..." }
Partial Update Properties of Many Items in Bulk¶
- 
PATCHitems-bulk/properties/¶ Note
Authorized Roles: root, manager, backend
Partially update some property values of many items. The properties that are not listed in the request body will be left unchanged. The list of values given for repeated properties will replace (not append) the previous list of values.
Use the body parameter
create_if_missingto control whether an error should be returned or new items should be created when theitem_iddoes not already exist.All property types need to be defined beforehand, see Items and Users Properties.
Note that
item_idcannot be a “null” or “falsy” value, such as empty string or0.- Request JSON Object
 items (object-array) –
(additional fields may be present) Items values
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
items_m2m (list-of-object) –
Optional. Items repeated values in array-optimized many-to-many format for binary clients [see Repeated Values]
Inner fields
name (string) – [max-length: 64] M2M name
array (object-array) – M2M array
Inner fields
item_index (uint32) – Item index (0-based)
value_id (any) – M2M related object ID
wait_for_completion (bool) – Optional. Default is
trueto wait for completion and respond with 200 OK. Set tofalseto respond immediately with 202 Accepted after validation, and process asynchronously in the background. The background process may take 30 seconds to start, and there is no way to get notified when the process is complete. No validation of items properties values is done beforehand, the background task may fail silently.create_if_missing (bool) – Optional. Create items that do not exist
EXAMPLE QUERY BODY (JSON client)¶{ "items": [ { "item_id": "123e4567-e89b-12d3-a456-426614174000", "price": 9.99, "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"] }, { "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "price": 4.49, "tags": ["family"], "genres": ["thriller"] } ], "create_if_missing": false }
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
n_created (int) – Number of items created (only when
wait_for_completion=true)n_modified (int) – Number of items modified (only when
wait_for_completion=true)ml_task_id (string) – Optional.
ml_new_itemsBackground Task ID. Only when items are created.
EXAMPLE RESPONSE¶{ "n_created": 17, "n_modified": 5, "ml_task_id": "4xBBB6qkqDbGdlyYRAjF" }
Errors:
WrongData with error name
WRONG_DATA_TYPEif the properties are invalidDuplicatedError with error name
DUPLICATED_ITEM_IDif anitem_idoccurs multiple times in the same requestNotFoundError only when create_if_missing=False with error name
ITEM_NOT_FOUNDif at least one item with the givenitem_idcannot be found
Delete Properties of Many Items in Bulk¶
- 
DELETEitems-bulk/properties/¶ Note
Authorized Roles: root, manager, backend
Delete the property values of many items in bulk. Ratings and interactions are not deleted.
This endpoint is not commonly used. Note that to stop recommending some items, it is preferable to perform a bulk partial update on a
statusproperty (or equivalent), and filter out the unwanted items using Filtering on Item Property. This allows the recommendation model to keep learning patterns of previously available items.This endpoint is typically used only after some developer mistake, when the property values of some items shouldn’t have been set.
- Request JSON Object
 items_id (ID-array) – Items IDs
EXAMPLE QUERY BODY¶{ "items_id": [ "123e4567-e89b-12d3-a456-426614174000", "c3391d83-553b-40e7-818e-fcf658ec397d" ] }
List Properties of Many Items by ID¶
- 
POSTitems-bulk/properties/list/¶ Note
Authorized Roles: root, manager, backend, frontend
Get property values of multiple items given their IDs. Note that the HTTP verb is
POSTso that items ids can be sent in the body, but the endpoint is stateless asGET.The item properties in the response are not aligned with the input. In particular this endpoint does not respond with 404 if any item in missing. Instead, the missing items are simply not present in the response.
Note that the array-optimized format
items_m2mfor repeated values is used only for binary clients. Otherwise (e.g. JSON client), the repeated values are formatted as lists in each individual items.- Request JSON Object
 items_id (ID-array) – Items IDs
properties (list-of-string) – Optional. Names of properties to fetch (by default, all properties are fetched)
EXAMPLE QUERY BODY¶{ "items_id": [ "123e4567-e89b-12d3-a456-426614174000", "c3391d83-553b-40e7-818e-fcf658ec397d" ], "properties": ["price", "tags", "genres"] }
- Response JSON Object
 warnings (list-of-string) – Optional. List of warnings
items (object-array) –
(additional fields may be present) Items values
Inner fields
item_id (ID) – [see Flexible Identifiers], [max_length: 64] Item ID
items_m2m (list-of-object) –
Items repeated values in array-optimized many-to-many format for binary clients [see Repeated Values]
Inner fields
name (string) – [max-length: 64] M2M name
array (object-array) – M2M array
Inner fields
item_index (uint32) – Item index (0-based)
value_id (any) – M2M related object ID
EXAMPLE RESPONSE (JSON client)¶{ "items": [ { "item_id": "123e4567-e89b-12d3-a456-426614174000", "price": 9.99, "tags": ["family", "sci-fi"], "genres": ["drama", "comedy"] }, { "item_id": "c3391d83-553b-40e7-818e-fcf658ec397d", "price": 4.49, "tags": ["family"], "genres": ["thriller"] } ] }
[Deprecated] Get Properties of One Item¶
- 
GETitems/<str:item_id>/¶ Note
Authorized Roles: root, manager, backend, frontend
[Deprecated] Create or Replace One Item¶
- 
PUTitems/<str:item_id>/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] Partial Update One Item¶
- 
PATCHitems/<str:item_id>/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] Delete One Item¶
- 
DELETEitems/<str:item_id>/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] Create or Replace Many Items in Bulk¶
- 
PUTitems-bulk/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] List Properties of All Items in Bulk¶
- 
GETitems-bulk/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] Partial Update Many Items in Bulk¶
- 
PATCHitems-bulk/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] Delete Many Items in Bulk¶
- 
DELETEitems-bulk/¶ Note
Authorized Roles: root, manager, backend
[Deprecated] List Properties of Many Items by ID¶
- 
POSTitems-bulk/list/¶ Note
Authorized Roles: root, manager, backend, frontend