Uploading orders (JSON)
Uploads orders.
The data is transmitted in the POST request body in JSON format. Learn more about the format of transmitted data.
For Yandex Metrica to process information about orders, you need to transmit customer data. Yandex Metrica links customer information to sessions, and order data to sessions and customers. This is necessary for calculating and displaying statistics.
Note. Для одного клиента можно передать не более 100 000 заказов.
Request syntax
counterId
: ID of the tag that you want to upload orders for.
https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/orders
? merge_mode=<update_type>
merge_mode * | Data saving mode. For any value, pass all required fields, even ones that aren't modified. Acceptable values:
|
merge_mode * | Data saving mode. For any value, pass all required fields, even ones that aren't modified. Acceptable values:
|
* Required
In the request body
--data '{
"orders": [
{
"id": "704",
"client_uniq_id": "J3QQ4-H7H2V-2HCH4-M3HK8-6M8VW",
"client_type": "CONTACT",
"order_status": "IN_PROGRESS",
"create_date_time": "2022-09-21 09:48:23",
"update_date_time": "2022-10-15 10:48:34",
"cost": 4000,
"revenue": 5000,
"goals": [
{
"goal_action_id": "goal_id1",
"price": 123.5
}
],
"products": {
"pear": 10,
"apple": 30
}
},
{
"id": "706",
"client_uniq_id": "ZYX4-H7H2V-2HCH4-M3HK8-6M8VW",
"client_type": "CONTACT",
"order_status": "PAID",
"create_date_time": "2022-09-30 10:48:23",
"cost": 10000,
"revenue": 13000,
"goals": [
{
"goal_action_id": "goal_id2",
"price": 123.5
}
],
"products": {
"apple": 30,
"cherry": 20
}
}
]
}'
Parameters | Description |
---|---|
orders | List of orders. |
orders | |
create_date_time | Date and time of order creation in the tag's time zone. You can't change this value. |
revenue | Revenue. Total value of the order. |
cost | Expenses. |
currency | Order currency in ISO 4217 format. |
goals | Goals and their costs in the order. |
id | Order ID. |
client_uniq_id | ID of the customer (uniq_id) who made this order. |
client_type | Type of customer who made this order. |
update_date_time | Date and time of order update in the tag's time zone. If the parameter is not passed, the value is inserted automatically. |
finish_date_time | Date and time of order completion in the tag's time zone. |
order_status | Order status ID. An arbitrary string. You can change the status. Specify the value that you passed when mapping statuses in the "id" field. |
products | Products in the order. |
goals | |
goal_action_id | JS goal ID. |
price | Goal cost in the order. |
Parameters | Description |
---|---|
orders | List of orders. |
orders | |
create_date_time | Date and time of order creation in the tag's time zone. You can't change this value. |
revenue | Revenue. Total value of the order. |
cost | Expenses. |
currency | Order currency in ISO 4217 format. |
goals | Goals and their costs in the order. |
id | Order ID. |
client_uniq_id | ID of the customer (uniq_id) who made this order. |
client_type | Type of customer who made this order. |
update_date_time | Date and time of order update in the tag's time zone. If the parameter is not passed, the value is inserted automatically. |
finish_date_time | Date and time of order completion in the tag's time zone. |
order_status | Order status ID. An arbitrary string. You can change the status. Specify the value that you passed when mapping statuses in the "id" field. |
products | Products in the order. |
goals | |
goal_action_id | JS goal ID. |
price | Goal cost in the order. |
Sample request
POST https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/orders?merge_mode=SAVE
Response format
{
"uploading" : {
"uploading_id" : < string > ,
"datetime" : < local_date_time > ,
"api_validation_status" : < api_validation_status > ,
"elements_count" : < integer > ,
"entity_type" : < entity_type > ,
"entity_subtype" : < string > ,
"uploading_format" : < uploading_format > ,
"uploading_source" : < uploading_source >
}
}
Parameters | Description |
---|---|
uploading | Upload information |
uploading | |
uploading_id | Upload ID |
datetime | Upload time |
api_validation_status | Upload validation status Possible values:
|
elements_count | Number of elements in the upload |
entity_type | Entity type Possible values:
|
entity_subtype | Entity subtype |
uploading_format | Upload format Possible values:
|
uploading_source | Upload source Possible values:
|
Parameters | Description |
---|---|
uploading | Upload information |
uploading | |
uploading_id | Upload ID |
datetime | Upload time |
api_validation_status | Upload validation status Possible values:
|
elements_count | Number of elements in the upload |
entity_type | Entity type Possible values:
|
entity_subtype | Entity subtype |
uploading_format | Upload format Possible values:
|
uploading_source | Upload source Possible values:
|