SailPlay implements the mechanism of processing of the cart's content. The processing of the cart's content and the products categories can be required in the following cases:
Each product in the SailPlay system receives the product ID in your system (SKU). Similarly, each category in the SailPlay system receives an ID in your system.
For each product, each category you should specify:
Correspondingly, when submitting information about the purchase you need additional information about the cart's content(see here).
When processing the cart's content the following rules are applied:
If the product with this SKU or the group with this ID does not exist in SailPlay's database, they are created automatically (without a name and other attributes).
If there is no special conversion rate for this product, it will be checked if there is a conversion rate for this category. If it does not exist, the default conversion rate is used.
If the same product is submitted in one array multiple times, the amounts are added first.
This method is used to add product categories. You should keep in mind that if the category has been created before when submitting information about the purchase (see here),then when adding the category with this SKU using this method, a new entry in the database will not be created; only relevant parameters (name, image, etc.) will be updated.
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | see here |
yes | store_department_id | see here |
yes | SKU | category ID in your system |
no | parent_SKU | Parent category (SKU). If it is not specified, the root category is set. |
no | name | Category name |
no | pic | Category image |
no | points_rate | Conversion rate from rubles to points. When this parameter is not specified, the value from settings is used. Format points_rate=0.45 |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Category ID |
create_date | Category creation date |
parent_SKU | Parent category |
points_rate | Bonus points rate in the created category |
pic | Category image URL |
Server Response Example:
{
status: 'ok',
SKU: 'SKU_1',
name: 'category name',
parent_SKU: 'SKU_2'
create_date: '2014-03-05T16:30:30.513',
points_rate: '0.004',
pic: '//d39c94cu632zjz.cloudfront.net/static/absolute_url.jpg'
}
Code | Description |
-7000 | The category name or SKU is already in use by another category. |
This method is used to edit category information. It should be noted that if some fields are not submitted in the request, then relevant attributes will not be changed for this category. To delete the parameter's value you should submit an empty string.
POST /api/v2/basket/categories/edit/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | Category ID in your system |
no | parent_SKU | Parent category (SKU) |
no | name | Category name |
no | pic | Category image |
no | points_rate | Conversion rate from dollars to points. When this parameter is not specified, the value from settings is used. Format points_rate=0.45 |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Category ID |
create_date | Category creation date |
points_rate | Bonus points rate in the created category |
pic | Category image URL |
Server Response Example:
{
status: 'ok',
SKU: 'SKU_1',
name: 'category name',
create_date: '2014-03-05T16:30:30.513',
points_rate: '0.004',
pic: '//d39c94cu632zjz.cloudfront.net/static/absolute_url.jpg'
}
Code | Description |
-7001 | The category name is already in use by another category. |
-7002 | There is no category for the submitted SKU |
This method is designed to receive the list of categories for products that have been added with the use of relevant methods (see here and here).
GET /api/v2/basket/categories/list/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
no | SKU | If it is specified, only information for the category with this SKU is displayed. It is mutually exclusive with parent_SKU |
no | parent_SKU | It limits the list of received categories by the specified category and its child category(ies). If it is not specified, all categories are displayed |
Parameter Name | Parameter Description |
status | Transaction status |
categories | Objects array with the following attributes: |
SKU | SKU (ID) in your system. |
parent_SKU | Parent category (SKU) |
name | Category name |
points_rate | Category conversion rate |
create_date | Creation date |
{
status: 'ok',
categories: [
{
SKU: 'c_1',
parent_SKU: 'SKU_3'
name: 'electronics',
points_rate: '0.1000',
pic: '//d39c94cu632zjz.cloudfront.net/static/e.jpg'
},
{
SKU: 'c_2',
parent_SKU: 'SKU_4'
name: 'food',
points_rate: '0.2500',
pic: '//d39c94cu632zjz.cloudfront.net/static/food.jpg'
},
....
]
}
This method is required to create some attribute for a product or a service. Products with the specified attribute can build a directory and be used to group products in the SailPlay's system.
POST /api/v2/basket/attributes/add/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system. |
yes | data_type | Datatype stored in the attribute. It can have the following values: bool, date, float, and text. |
no | name | Name. If it is not specified, the empty value is saved. |
no | pic | Product image file (not a link) |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Product ID |
parent_SKU | Parent directory SKU (ID) |
name | Directory Name |
data_type | Datatype |
values | Available values array |
{
status: 'ok',
SKU: 'attribute_1',
parent_SKU: 'attribute_2'
name: 'attribute name',
data_type: 'bool'
values: [SKU: 'product_01', ‘value’: 'true'})]
}
This method is required to edit a directory (attribute).
Only SKU parameter is mandatory. Only parameters specified in the request will be changed.
To delete the parameter's value you should submit an empty string.
It should be noted that the attribute 'data_type' can't be changed.
POST /api/v2/basket/attributes/edit/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system |
no | name | Name. If it is not specified, the empty value is saved. |
no | parent_SKU | Parent directory SKU (ID): If it is not specified, the empty value is saved. |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Attribute ID |
parent_SKU | Parent directory SKU (ID) |
name | Directory Name |
data_type | Data type |
{
status: 'ok',
SKU: 'attribute_1',
parent_SKU: 'attribute_4'
name: 'attribute name2',
data_type: 'bool'
values: [SKU: 'product_01', ‘value’: 'true'})]
}
This method is designed to receive the list of directories (attributes) that have been added with the use of relevant methods, as well as the array of SKU values that have been assigned an attribute and its value.
POST /api/v2/basket/attributes/list/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
no | SKU | If it is specified, only information for one directory is displayed. It is mutually exclusive with parent_SKU |
no | parent_SKU | It limits the list of received directories by the specified directory and its child directory(ies). If it is not specified, all directories are displayed. |
Parameter Name | Parameter Description |
status | Transaction status |
attributes | Array of objects with the description of directories and the array of their values: |
SKU | Attribute ID |
parent_SKU | Parent directory SKU (ID) |
name | Directory Name |
values | Array of available values (array of objects in form of {‘SKU’: , ‘value’: }) |
{
status: 'ok',
"attributes": [
{
SKU: 'attribute_1',
parent_SKU: 'attribute_4'
name: 'attribute name1',
values: [SKU: 'product_01', ‘value’: 'true'}
{
SKU: 'attribute_2',
parent_SKU: 'attribute_4'
name: 'attribute name2',
values: [SKU: 'product_02', ‘value’: 'null'}
]
}
The method returns 100 products on the page per request.
If SKU is submitted, only information for one directory is displayed. If parent_SKU is submitted the list of received directories will be limited by the specified directory and child directory(ies) for parent_SKU.
This method is designed to add values for various created directories (attributes). Values and their names can be added for each attribute. The number of values for attributes is not limited
POST /api/v2/basket/attributes/values/add/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system |
no | value_SKU | Value name |
no | value | Attribute value according to the data_type of the attribute |
Parameter Name | Parameter Description |
status | Transaction status |
values | Array of values for the specified directory (attribute) with names |
{
status: 'ok',
values: [SKU: 'is_jnvls', ‘value’: 'true'})]
}
If SKU already has a relevant attribute, an error will be returned:
{"status": "error", "message": "Value with such SKU already exists for this attribute"}
This method is required to edit values of a directory (attribute).
Only SKU parameter is mandatory. Only parameters specified in the request will be changed.
To delete the parameter's value you should submit an empty string.
It should be noted that the attribute 'data_type' can't be changed.
POST /api/v2/basket/attributes/values/edit/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system |
yes | value_SKU | Value name. It can't be changed |
yes | value | Attribute value according to the data_type of the attribute. It can be changed |
Parameter Name | Parameter Description |
status | Transaction status |
{
status: 'ok'
}
This method allows receiving an array of permitted values with their names for one of the attributes.
POST /api/v2/basket/attributes/values/list/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system |
Parameter Name | Parameter Description |
status | Transaction status |
values | Array of permissible values for the specified directory (attribute) |
{ status: 'ok',
"values": [
{
SKU: 'product_1'
value: state_1}
{
SKU: 'product_2'
value: state_2}
]
}
This method allows removing values from a specified directory (attribute).
POST /api/v2/basket/attributes/values/delete/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of the attribute in your system |
yes | value_SKU | The name of the value to be removed |
Parameter Name | Parameter Description |
status | Transaction status |
{
status: 'ok'
}
This method is required to add information about the product to SailPlay's system. You should keep in mind that information about products can be added to the SailPlay's system via the request of the purchase adding.
POST /api/v2/basket/products/add/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of this product in your system |
no | name | Product name |
no | price | Product price |
no | category_SKU | Category SKU (ID) |
no | points_rate | Conversion rate from rubles to points for this product. |
no | points_rate | Conversion rate from rubles to points for this product. |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Product ID |
create_date | Product creation date |
points_rate | Bonus points rate for the created product |
price | Product price |
pic | Product image URL |
category_SKU | Category SKU |
attributes | Product range attributes |
{
status: 'ok',
SKU: 'product_SKU_1',
name: 'product name',
create_date: '2014-03-05T16:30:30.513',
points_rate: '0.05',
price: '100.0000'
pic: '//d39c94cu632zjz.cloudfront.net/static/absolute_url.jpg',
category_SKU: 'category SKU'
attributes: []
}
Code | Description |
-7002 | There is no category for the submitted SKU |
-7003 | There is no product for the submitted SKU or the name exists already |
This method is used to edit product information.
Only SKU parameter is mandatory. Only specified parameters will be changed.
To delete the parameter's value you should submit an empty string.
POST /api/v2/basket/products/edit/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | SKU (ID) of this product in your system |
no | name | Product name |
no | price | Product price |
no | category_SKU | Category SKU (ID) |
no | points_rate | Conversion rate from rubles to points for this product. |
Parameter Name | Parameter Description |
status | Transaction status |
SKU | Product ID |
create_date | Product creation date |
points_rate | Bonus points rate for the created product |
price | Product price |
pic | Product image URL |
category_SKU | Category SKU |
attributes | Product range attributes |
{
status: 'ok',
SKU: 'product_SKU_1',
name: 'product name',
create_date: '2014-03-05T16:30:30.513',
points_rate: '0.05',
price: '100.0000'
pic: '//d39c94cu632zjz.cloudfront.net/static/absolute_url.jpg',
category_SKU: 'category SKU'
attributes: []
}
Code | Description |
-7002 | There is no category for the submitted SKU |
-7004 | The submitted name is already in use by another product |
-7005 | There is no product for the submitted SKU |
This method is designed to receive the list of products that have been added with the use of relevant methods (see here and here).
GET /api/v2/basket/products/list/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
no | SKU | Product SKU. If it is specified, only information for one product is displayed. |
no | category_SKU | Products category SKU. It limits the list of products by the specified category and its child category(ies). If it is not specified, all products are displayed. |
no | page | Page number |
Parameter Name | Parameter Description |
status | Transaction status |
num_pages | Number of pages |
products | Objects array with the following attributes: |
SKU | SKU (ID) of the product in your system. |
attributes | The object that contains the list and values of the product's attributes. |
name | Product name |
category_SKU | The category of the product |
points_rate | Conversion rate for this product |
create_date | Creation date |
{
status: 'ok',
num_pages: 3,
products: [
{
SKU: 'a_1',
name: 'notebook',
points_rate: '0.1000',
pic: '//d39c94cu632zjz.cloudfront.net/static/notebook.jpg',
category_SKU: 'e_1'
"attributes": [
{
"SKU": "attr1",
"values": [
{
"SKU": null,
"value": "va3"
}
],
"name": "first"
}
],
},
{
SKU: 'a_2',
name: 'tablet pc',
points_rate: '0.2500',
pic: '//d39c94cu632zjz.cloudfront.net/static/tablet.jpg',
category_SKU: 'e_1'
"attributes": [
{
"SKU": "attr2",
"values": [
{
"SKU": null,
"value": "va4"
}
],
"name": "first"
}
],
},
....
]
}
This method is designed to add directories (attributes) for created products. Different attributes with different values can be added for each product. The number of attributes is not limited.
POST /api/v2/basket/products/attributes/add/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | Product ID |
yes | attribute_SKU | SKU of the created directory (attribute) |
yes | value_SKU | Attribute value according to the data_type of the attribute |
Parameter Name | Parameter Description |
status | Transaction status |
{
status: 'ok'
}
This method is required to edit an attribute for a product.
To edit the attribute's value you should submit both an old and a new value.
It should be noted that the new value should correspond to the 'data_type' of the attribute (directory).
POST /api/v2/basket/product/attributes/edit/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | Product SKU |
yes | attribute_SKU | SKU (ID) of the attribute in your system |
yes | value_SKU_from | Attribute value before change |
yes | value_SKU_to | Desired (new) attribute value |
Parameter Name | Parameter Description |
status | Transaction status |
{
status: 'ok'
}
This method allows removing values from a specified directory (attribute).
POST /api/v2/basket/products/attributes/delete/
Is the parameter mandatory? | Parameter Name | Parameter Description |
yes | token | See here |
yes | store_department_id | See here |
yes | SKU | Product SKU |
yes | attribute_SKU | SKU (ID) of the attribute in your system |
Parameter Name | Parameter Description |
status | Transaction status |
{
status: 'ok'
}