Skip to main content

Old Order Migration

The migration file can be in csv, xls or json format. The column names of the migration file must match the file names in the table below. It allows Old order migrations can be made with the file. Migration processes can be sustained with this process. The data is taken with a file in a simple format and then transferred to the shop (Commerce) application via the shell with the script run on the backend.

Field NamesData TypeRequiredDescriptions
numberstringtrueOrder ID (Max 128 Characters)
userstringtrueThe customer code of the user
user_emailstringtrueThe email of the user
statusstringtrueOrder status code](/docs/guide/integration/order/order-status) (Max 64 Characters)
created_datedatetrueThe creation date of the order
amountfloattrueMax digits:12, max decimal place: 2
discount_amountfloatfalseMax digits:12, max decimal place: 2
currencystringtrue(/docs/guide/integration/migration/migration-property-choices)
payment_typestringtrueMax 64 characters
bankstringtrueMax 64 characters
installment_countintegerfalseMinimum value is 1 if provided
tracking_numberstringtrueMax 64 characters
shipping_companystringtrue(/docs/guide/integration/migration/migration-property-choices)
shipping_addressstringtrueMax 512 characters
billing_addressstringtrueMax 512 characters
extra_fieldjsonfalseThe extra information that should be kept in the order

ParameterData TypeInDescriptions
channel_idintegerurlThe id of the shop channel
api_tokenstringheaderThe API key of the customer account
filesdisctbodyThe dictionary includes the file descriptor or the migration file
migration_idstringurlThe type of migration (user, address, order, order_item etc.)

A request is sent to start the migration to the endpoint related to the parameters in the table given above.

The flow continues with the data in the file sent with the files parameter.

Request POST

In order to initiate an address migration to the /api/v1/remote/{channel_id}/migrations/start/{migration_type} endpoint using the parameters mentioned above and trigger the queue, the migration key value is specified as order and a POST request is sent.

Path: /api/v1/remote/{channel_id}/migrations/start/{migration_type}


import requests
import json

url = "https://{customer_api_url}/api/v1/remote/{channel_id}/migrations/start/{migration_type}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'content-type': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}
files = {'file': open('/path/to/file/address.csv','rb')}
response = requests.post(url, headers=headers, files=files)
print(response.text)

Response

As a result of the request, it can be seen that the operation was carried out successfully with a 200 OK response code.

{
"migration_id": "4d6f7650799f484d875a89adf8d472b8"
}