Order Update
The user can update the order properties. In order to do this, the user needs to know the order number field. User can extract this information with Get HTTP requests. See the Get Orders section for more information.
Parameter | Data Type | In | Description |
api_token | string | header | The API key of the customer account |
{order_no} | string | query | Order no |
PATCH
Update Order
Path: /api/i1/orders/{order_no}/
Sample HTTP request to update order is_send
parameter to True. There might be some restrictions, see the Bad Request Response section for more information.
content_type
header represents the response type.Authorization
header is a required header for authentication. You can retrieve api_token with login.
Example Request
import requests
import json
url = "https://{customer_api_url}/api/i1/orders/{order_no}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
headers = {
'content-type': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}
data = {
'is_send': True
}
response = requests.patch(url, headers=headers , data=json.dumps(data))
print(response.text)
Example Response
Expected response status code is 200-Successful. Returns updated version of the order properties. Order Properties are listed in the below table.
Resource properties are in Python format.
Property | Data Type | Description |
number | integer | Order code |
status | string | Status of order in the current time. Order statuses are predefined. See the meaning of the status in the Order Status section |
date_placed | iso date str | Created date of the order |
customer | dict | Related Customer object. See the Customer section for more details about the fields in the customer dictionary. |
shipping_address | dict | Related Address object. See the Address section for more details about the fields in the shipping_address dictionary. |
billing_address | dict | Related Address object. See the Address section for more details about the fields in the billing_address dictionary. |
currency | string | Currency type of the transaction. Currency types are predefined. Every currency type is a global abbreviation of the currency. |
amount | string | Amount of the order |
shipping_amount | string | Shipping amount of the order |
shipping_tax_rate | string | Shipping tax rate of the order |
extra_field | dict | Usage of extra information. |
payment_option | int | Related Payment Option object ID. See the Payments section for more information. |
payment_option_slug | string | Unique slug information related to the Payment Option object. |
bin_number | string | Bin Number |
installment | int | Related Installment object ID. See the Payments section for more information |
installment_count | int | Installment count information related to the Installment object. |
installment_interest_amount | string | Calculated by (amount of the order * installment interest rate) Installment interest rate is the related Installment object info. |
cargo_company | int | Related Cargo Company object ID. |
invoice_number | string | Invoice number |
invoice_date | Iso date str | Invoice date |
e_archieve_url | Url field str | e-archive url info |
refund_amount | string | Refund amount |
discount_refund_amount | string | Discount refund amount |
shipping_refund_amount | string | Shipping refund amount |
shipping_refund_amount | string | Shipping refund amount |
discount_amount | string | Discount amount |
is_send | boolean | True means order sent to ERP. |
net_shipping _amount | string | Net shipping amount. (Shipping amount + Shipping Interest Amount) |
shipping_interest_amount | string | Shipping Interest amount |
tracking_number | string | Tracking number for cargo integration |
carrier_shipping_code | string | Shipping code for cargo integration |
remote_addr | string | Generic IP address for the orders created. |
has_gift_box | boolean | Gift Box is selected or not |
gift_box_note | string | Note for the gift box |
external_status | int | Related Order External Status object ID. |
orderitem_set | list | Each element is the related Order Item object. See the Order Item section for more information. |
channel | dict | Related Channel object. See the Channel section for more information. |
{
"id": 167848,
"number": "1709543666312451",
"status": "450",
"date_placed": "2019-06-17T13:35:47.026886Z",
"customer": {
"email": "example@email.com ",
"first_name": "Lorem",
"last_name": "Ipsum",
"phone_number": null
},
"shipping_address": {
"email": "example@email.com ",
"phone_number": "05XXXXXXXX",
"first_name": "Lorem",
"last_name": "Ipsum",
"country": {
"name": "Italy",
"code": "it"
},
"city": {
"id": 1,
"name": "MILANO"
},
"line": "Viale Edoardo Jenner",
"title": "dolor sit amet",
"township": {
"id": 1,
"name": "20158 Milano MI"
},
"district": {
"id": 5,
"name": "Lorem Ipsum"
},
"postcode": "",
"notes": null,
"company_name": "",
"tax_office": "",
"tax_no": "",
"e_bill_taxpayer": false
},
"billing_address": {
"email": "example@email.com ",
"phone_number": "05XXXXXXXX",
"first_name": "Lorem",
"last_name": "Ipsum",
"country": {
"name": "Italy",
"code": "it"
},
"city": {
"id": 1,
"name": "MILANO"
},
"line": "Viale Edoardo Jenner",
"title": " dolor sit amet",
"township": {
"id": 1,
"name": "20158 Milano MI"
},
"district": {
"id": 5,
"name": "Lorem Ipsum"
},
"postcode": "",
"notes": null,
"company_name": "",
"tax_office": "",
"tax_no": "",
"e_bill_taxpayer": false
},
"currency": "try",
"amount": "107.00",
"shipping_amount": "7.00",
"shipping_tax_rate": null,
"extra_field": {},
"payment_option": 2,
"payment_option_slug": "kredi_karti",
"bin_number": null,
"installment": null,
"installment_count": 1,
"installment_interest_amount": "0.00",
"cargo_company": 1,
"invoice_number": "12345",
"invoice_date": null,
"e_archive_url": "http://www.zrrcovgizghvjpsveflc.com/",
"refund_amount": "0.00",
"discount_refund_amount": "0.00",
"shipping_refund_amount": "0.00",
"discount_amount": "0.00",
"is_send": true,
"net_shipping_amount": 7,
"shipping_interest_amount": "0.00",
"tracking_number": "11111111",
"carrier_shipping_code": null,
"remote_addr": "213.194.76.106",
"has_gift_box": false,
"gift_box_note": null,
"external_status": null,
"orderitem_set": [
{
"id": 1,
"order": 1,
"product_sku": "1185185001",
"status": "550",
"price_currency": "try",
"price": "100.00",
"tax_rate": "18.00",
"extra_field": {},
"price_list": 1,
"stock_list": 1,
"cancel_status": null,
"invoice_number": "12345",
"invoice_date": null,
"e_archive_url": "http://www.zrrcovgizghvjpsveflc.com/",
"installment_interest_amount": "0.00",
"tracking_number": "11111111",
"carrier_shipping_code": null,
"shipping_company": "other",
"shipment_code": null,
"external_status": null,
"discount_amount": "0.00",
"retail_price": null,
"attributes": {},
"attributes_kwargs": {},
"image": null
}
]
}
Example Bad Responses
Expected response status codes are greater than/equal to 400 and less than 500. Returns the reason why it is not an acceptable request.
If any of the order_item
has cancel_status
, the user cannot perform an update on the order.
{
"non_field_errors": 'cancel_status cannot be updated from approved to confirmed'
' and waiting_for_payment to less than waiting_for_payment'
"error_code": 'order_item_101_1',
}