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 Names | Data Type | Required | Descriptions |
number | string | true | Order ID (Max 128 Characters) |
user | string | true | The customer code of the user |
user_email | string | true | The email of the user |
status | string | true | Order status code](/docs/guide/integration/order/order-status) (Max 64 Characters) |
created_date | date | true | The creation date of the order |
amount | float | true | Max digits:12, max decimal place: 2 |
discount_amount | float | false | Max digits:12, max decimal place: 2 |
currency | string | true | (/docs/guide/integration/migration/migration-property-choices) |
payment_type | string | true | Max 64 characters |
bank | string | true | Max 64 characters |
installment_count | integer | false | Minimum value is 1 if provided |
tracking_number | string | true | Max 64 characters |
shipping_company | string | true | (/docs/guide/integration/migration/migration-property-choices) |
shipping_address | string | true | Max 512 characters |
billing_address | string | true | Max 512 characters |
extra_field | json | false | The extra information that should be kept in the order |
Parameter | Data Type | In | Descriptions |
channel_id | integer | url | The id of the shop channel |
api_token | string | header | The API key of the customer account |
files | disct | body | The dictionary includes the file descriptor or the migration file |
migration_id | string | url | The 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"
}