Import order and item statuses
Description
Imports an order, payment method and statuses of order items into the market.
Request URL
Method: POST
https://example.com/api/v1.1/market/orders/import
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token. Make sure that market roles are available for the token. |
custom_fields | array of objects | [ | No | Create custom fields for the following entities:
|
custom_line_statuses | array of objects | [ | No | Custom status of the order item. It is necessary to pass the status id ( external_id ), its name (name ) and type (type ). Possible values of the type field:
|
skip_triggers | bool | true | No | Skip trigger events. By default – false |
data | array of objects | [ | Yes | Order data. Learn more |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"custom_fields": [
{
"external_id": "order_field_id_123",
"name": "Additional order field",
"entity_type": "order",
"required": false,
"value_type": "unicode",
"default_value": "value of the test field"
},
{
"external_id": "line_field_id_123",
"name": "Additional field of the order item",
"entity_type": "line_order",
"required": false,
"value_type": "unicode",
"default_value": "value of the test field"
}
],
"custom_line_statuses": [
{
"external_id": "status_id_123",
"name": "Delivered to pick-up point",
"type": "in_process"
}
],
"skip_triggers": true,
"data": [
{
"external_id": "1234000",
"matching": "email",
"email": "johndoe@example.com",
"endpoint": "website",
"tags": ["one", "two"],
"status": "delivered",
"delivery_cost": "100",
"total_price": "1000",
"currency": "USD",
"create_time": "2022-01-02T15:04:05.141Z",
"custom_fields": {
"order_field_id_123": "data"
},
"region": "region_YnCrJj8Y1",
"lines": [
{
"external_id": "line_01",
"status": "status_id_123",
"product": "iphone_test_1",
"base_price_per_item": "900",
"min_price_per_item": "900",
"final_price_per_item": "900",
"count": 1,
"custom_fields": {
"line_field_id_123": "data"
}
}
]
}
]
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<custom_fields>
<external_id>order_field_id_123</external_id>
<name>Additional order field</name>
<entity_type>order</entity_type>
<required>false</required>
<value_type>unicode</value_type>
<default_value>value of the test field</default_value>
</custom_fields>
<custom_fields>
<external_id>line_field_id_123</external_id>
<name>Additional field of the order item</name>
<entity_type>line_order</entity_type>
<required>false</required>
<value_type>unicode</value_type>
<default_value>value of the test field</default_value>
</custom_fields>
<custom_line_statuses>
<external_id>status_id_123</external_id>
<name>Delivered to the pick-up point</name>
<type>in_process</type>
</custom_line_statuses>
<skip_triggers>true</skip_triggers>
<data>
<external_id>1234000</external_id>
<matching>email</matching>
<email>johndoe@example.com</email>
<endpoint>website</endpoint>
<tags>one</tags>
<tags>two</tags>
<status>delivered</status>
<delivery_cost>100</delivery_cost>
<total_price>1000</total_price>
<currency>USD</currency>
<create_time>2022-01-02T15:04:05.141Z</create_time>
<custom_fields>
<order_field_id_123>data</order_field_id_123>
</custom_fields>
<region>region_YnCrJj8Y1</region>
<lines>
<external_id>line_01</external_id>
<status>status_id_123</status>
<product>iphone_test_1</product>
<base_price_per_item>900</base_price_per_item>
<min_price_per_item>900</min_price_per_item>
<final_price_per_item>900</final_price_per_item>
<count>1</count>
<custom_fields>
<line_field_id_123>data</line_field_id_123>
</custom_fields>
</lines>
</data>
</xml>
Response example
- JSON
- XML
{
"error": 0,
"error_text": "",
"result": [
{
"error": 0,
"external_id": "1234000"
}
]
}
<xml>
<error>0</error>
<error_text></error_text>
<result>
<error>0</error>
<external_id>1234000</external_id>
</result>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
result | array | Product IDs that were successfully imported |