Skip to main content

Old Order Item Migration

Order item migrations will not be successful without completing user and order migrations beforehand. Migrated order items are stored in the database as a distinct model, separate from the Order Item model in Omnitron. As a result, they won't be displayed on the panel. Users can view their complete past orders on this page {{shop_url}}/users/old-orders/{{pk}}.

Example Request

curl --location --request POST 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/start/order_item/' \
--header 'Authorization: Token {{token}}' \
--form 'file=@"/path/to/test_order-item.json"'

Test Order Item File Format (test_order-item.json)

[
{
"order_number": "ORD1234",
"product": "dolor sit amet",
"sku": "s1k2u30001",
"quantity": 1,
"price": 123.90,
"image_url": "https://testurl.com/test_picture.jpg",
"extra_field": {}
}
]

Description:

Here are the data format requirements for each field in the context of order item migration:

  • "order_number": Should be in String format, mandatory. Must match the "number" field in order migration.
  • "product": Should be in String format. Can be null or an empty string. Limited to 256 characters.
  • "sku": Should be in String format. Can be null or an empty string. Limited to 128 characters.
  • "quantity": Should be in Integer format, mandatory. Can be null. Value must be at least 1.
  • "price": Should be in Float format, maximum of 12 digits, accepting 2 digits after the decimal point. Mandatory.
  • "image_url": Should be in URL format, mandatory. Can be null or an empty string.
  • "extra_field": Should be in Dictionary format. If empty, it should be provided as {}.

Example Response

When a request is made, the response received will be as follows:

{"migration_id": "2740e84efe2e4bea91615f46f567aa3c"}

Control

For verification, the following request is sent:


curl --location --request GET 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/{{migration_id}}/progress/' \
--header 'Authorization: Token {{token}}'

If the response received is as follows:

{
"total_count": 1,
"error_count": 0,
"processed_count": 1
}

It means that the order item has been successfully migrated.