Uploading orders (JSON)
Uploads orders.
The data is submitted within 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 required to calculate and display statistics.
Note
You can transmit data for up to 100,000 orders per customer.
Sample 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
}
}
]
}'
Request
POST
https://api-metrika.yandex.net/cdp/api/v1/counter/{counterId}/data/orders/json
Path parameters
Name |
Description |
counterId* |
Type: integer<int32> ID of the counter for which you want to upload orders. |
Query parameters
Name |
Description |
merge_mode* |
Type: string Data saving mode. For any value, pass all required fields, even ones that aren't modified. |
Body
application/json
{
"orders": [
{
"attribute_values": [
[
"string"
]
],
"revenue": 0,
"cost": 0,
"currency": "string",
"goals": [
{
"goal_action_id": "string",
"price": 0
}
],
"create_date_time": "2022-12-29T18:02:01Z",
"id": "string",
"client_uniq_id": "string",
"client_type": "string",
"update_date_time": "2022-12-29T18:02:01Z",
"finish_date_time": "2022-12-29T18:02:01Z",
"order_status": "string",
"products": 0
}
]
}
Name |
Description |
orders* |
Type: OrderRow[] List of orders. Min items: |
OrderRow
List of orders.
Name |
Description |
client_type* |
Type: string Type of customer who placed this order. Possible values:
|
client_uniq_id* |
Type: string ID of the customer ( Min length: |
create_date_time* |
Type: string<date-time> Date and time of order creation in the counter's time zone. You can't change this value. |
id* |
Type: string Order ID. Min length: |
order_status* |
Type: string Order status ID. An arbitrary string. You can change the status. Specify the value that you passed when mapping statuses in the id field. Min length: |
attribute_values |
Type: string[][] Custom attributes. Unique items |
cost |
Type: number Expenses. Max value: |
currency |
Type: string Order currency in ISO 4217 format. |
finish_date_time |
Type: string<date-time> Date and time of order completion in the counter's time zone. |
goals |
Type: CdpGoalExternal[] Goals and their costs in the order. Min items: Max items: |
products |
Type: integer<int32> Products in the order. |
revenue |
Type: number Revenue. Total value of the order. Max value: |
update_date_time |
Type: string<date-time> Date and time of order update in the counter's time zone. If the parameter is not passed, the value is inserted automatically. |
CdpGoalExternal
Goals and their costs in the order.
Name |
Description |
goal_action_id* |
Type: string ID of the JS goal. |
price |
Type: number Goal cost in the order. |
Responses
200 OK
OK
Body
application/json
{
"uploading": {
"uploading_id": "string",
"datetime": "2022-12-29T18:02:01Z",
"api_validation_status": "string",
"elements_count": 0,
"entity_type": "string",
"uploading_format": "string",
"uploading_source": "string"
}
}
Name |
Description |
uploading |
Type: UploadingMetaExternal Description of the |
UploadingMetaExternal
Description of the UploadingMetaExternal
object.
Name |
Description |
api_validation_status |
Type: string Upload validation status:
|
datetime |
Type: string<date-time> Upload time. |
elements_count |
Type: integer<int32> Number of elements within the upload. |
entity_type |
Type: string Entity type:
|
uploading_format |
Type: string Upload format. Possible values:
|
uploading_id |
Type: string Upload ID. |
uploading_source |
Type: string Upload source. Possible values: |
No longer supported, please use an alternative and newer version.