# Search Order

The user can filter specific orders in the system. All filtering options are listed below with their detailed descriptions.

<table data-header-hidden><thead><tr><th width="117.6484375"></th><th width="107.8203125"></th><th width="104.21484375"></th><th width="105.140625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Required</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>Yes</td><td>header</td><td><a href="../../getting-started">The API key of the customer’s account</a></td></tr><tr><td>limit</td><td>integer</td><td>No</td><td>query</td><td>Amount of items per page that will be returned. Default value is 10</td></tr><tr><td>page</td><td>string</td><td>No</td><td>query</td><td>Page number to return. Default value is 1</td></tr><tr><td>status</td><td>string</td><td>No</td><td>params</td><td>Order status code</td></tr><tr><td>is_send</td><td>boolean</td><td>No</td><td>params</td><td>Whether the order was sent to the ERP. If False the system will fetch orders that have not yet been sent to the ERP.</td></tr></tbody></table>

## <mark style="color:red;">`GET`</mark> <mark style="color:red;"></mark><mark style="color:red;">Search Orders</mark>

**Path:** `/api/i1/orders/`

Sample HTTP request to filter orders. Below example only retrieves where order status is 400 (approved).

* `content_type` header represents the response type.
* `Authorization` header is a required header for authentication. You can retrieve api\_token with login.

**Example Request**

```python
import requests

url = "https://{customer_api_url}/api/i1/orders/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
   'content-type': 'application/json',
   'Authorization': 'Token {}'.format(api_token)
}
Params = {
   'status': '400'
}

response = requests.get(url, headers=headers , params=params)
print(response.text)
}
```

**Example Response**

Response contains all order data with search parameters and with pagination. Response status is expected to be HTTP-200 Successful. All parameters of an order described in the below table.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="140.6875"></th><th width="135.23828125"></th><th></th></tr></thead><tbody><tr><td><strong>Property</strong></td><td><strong>Data Type</strong></td><td><strong>Description</strong></td></tr><tr><td>number</td><td>integer</td><td>Order code</td></tr><tr><td>status</td><td>string</td><td>Status of order in the current time. Order statuses are predefined. You can look up for meaning of the status in the Order Status section</td></tr><tr><td>date_placed</td><td>iso date str</td><td>Created date of the order</td></tr><tr><td>customer</td><td>dict</td><td>Related Customer object. See the Customer section for more details about the fields in the customer dictionary.</td></tr><tr><td>shipping_address</td><td>dict</td><td>Related Address object. See the Address section for more details about the fields in the shipping_address dictionary.</td></tr><tr><td>billing_address</td><td>dict</td><td>Related Address object. See the Address section for more details about the fields in the billing_address dictionary.</td></tr><tr><td>currency</td><td>string</td><td>Currency type of the transaction. Currency types are predefined. Every currency type is a global abbreviation of the currency.</td></tr><tr><td>amount</td><td>string</td><td>Amount of the order</td></tr><tr><td>shipping_amount</td><td>string</td><td>Shipping amount of the order</td></tr><tr><td>shipping_tax_rate</td><td>string</td><td>Shipping tax rate of the order</td></tr><tr><td>extra_field</td><td>dict</td><td>Usage of extra information.</td></tr><tr><td>payment_option</td><td>int</td><td>Related Payment Option object ID. See the Payments section for more information.</td></tr><tr><td>payment_option_slug</td><td>string</td><td>Unique slug information related to the Payment Option object.</td></tr><tr><td>bin_number</td><td>string</td><td>Bin Number</td></tr><tr><td>installment</td><td>int</td><td>Related Installment object ID. See the Payments section for more information</td></tr><tr><td>installment_count</td><td>int</td><td>Installment count information related to the Installment object.</td></tr><tr><td>installment_interest_amount</td><td>string</td><td>Calculated by (amount of the order * installment interest rate) \ Installment interest rate is the related Installment object info.</td></tr><tr><td>cargo_company</td><td>int</td><td>Related Cargo Company object ID.</td></tr><tr><td>invoice_number</td><td>string</td><td>Invoice number</td></tr><tr><td>invoice_date</td><td>Iso date str</td><td>Invoice date</td></tr><tr><td>e_archieve_url</td><td>Url field str</td><td>e archive url info</td></tr><tr><td>refund_amount</td><td>string</td><td>Refund amount</td></tr><tr><td>discount_refund_amount</td><td>string</td><td>Discount refund amount</td></tr><tr><td>shipping_refund_amount</td><td>string</td><td>Shipping refund amount</td></tr><tr><td>shipping_refund_amount</td><td>string</td><td>Shipping refund amount</td></tr><tr><td>discount_amount</td><td>string</td><td>Discount amount</td></tr><tr><td>is_send</td><td>boolean</td><td>True means order sent to ERP.</td></tr><tr><td>net_shipping _amount</td><td>string</td><td>Net shipping amount. (Shipping amount + Shipping Interest Amount)</td></tr><tr><td>shipping_interest_amount</td><td>string</td><td>Shipping Interest amount</td></tr><tr><td>tracking_number</td><td>string</td><td>Tracking number for cargo integration</td></tr><tr><td>carrier_shipping_code</td><td>string</td><td>Shipping code for cargo integration</td></tr><tr><td>remote_addr</td><td>string</td><td>Generic IP address for the orders created.</td></tr><tr><td>has_gift_box</td><td>boolean</td><td>Gift Box is selected or not</td></tr><tr><td>gift_box_note</td><td>string</td><td>Note for the gift box</td></tr><tr><td>external_status</td><td>int</td><td>Related Order External Status object id.</td></tr><tr><td>orderitem_set</td><td>list</td><td>Each element is the related Order Item object. See the Order Item section for more information.</td></tr><tr><td>channel</td><td>dict</td><td>Related Channel object. See the Channel section for more information.</td></tr></tbody></table>

* `count` shows how many orders exist in the system.
* `next` shows the next page url to retrieve the desired orders
* `previous` shows the previous page url to retrieve the desired orders.
* `results` shows every order property with detailed field descriptions.

```json
{
 "count": 595,
 "next": "https://{customer_api_url}/api/i1/orders/?limit=2&page=2",
 "previous": null,
 "results": [
   {
     "id": 1,
     "number": "1055565228112825",
     "status": "400",
     "date_placed": "2019-06-17T13:35:47.026886Z",
     "customer": {
       "id": 1,
       "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
       }
     ],
     "channel": {
         "name": "Shop",
         "conf": {
             "server": "https://example-shop.com.tr/api/v1/"         
         }
     }
   },
   {
     "id": 2,
     "number": "1056370250512517",
     "status": "400",
     "date_placed": "2019-06-18T11:57:28.471578Z",
     "customer": {
       "id": 1,
       "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": 28,
         "name": "ROME"
       },
       "line": "00184",
       "title": "Akinon Busimess",
       "township": {
         "id": 318,
         "name": "Rome"
       },
       "district": {
         "id": 24444,
         "name": "Lorem Ipsum"
       },
       "postcode": "43211",
       "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": 28,
         "name": "ROME"
       },
       "line": "00184",
       "title": "Akinon İş",
       "township": {
         "id": 318,
         "name": "Rome"
       },
       "district": {
         "id": 24444,
         "name": "Lorem Ipsum"
       },
       "postcode": "43211",
       "notes": null,
       "company_name": "",
       "tax_office": "",
       "tax_no": "",
       "e_bill_taxpayer": false
     },
     "currency": "try",
     "amount": "207.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": null,
     "invoice_date": null,
     "e_archive_url": null,
     "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": "09847356",
     "carrier_shipping_code": null,
     "remote_addr": "213.194.76.106",
     "has_gift_box": false,
     "gift_box_note": null,
     "external_status": null,
     "orderitem_set": [
       {
         "id": 3,
         "order": 2,
         "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": null,
         "invoice_date": null,
         "e_archive_url": null,
         "installment_interest_amount": "0.00",
         "tracking_number": "09847356",
         "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
       },
       {
         "id": 2,
         "order": 2,
         "product_sku": "1081448001",
         "status": "450",
         "price_currency": "try",
         "price": "100.00",
         "tax_rate": "18.00",
         "extra_field": {},
         "price_list": 1,
         "stock_list": 1,
         "cancel_status": null,
         "invoice_number": null,
         "invoice_date": null,
         "e_archive_url": null,
         "installment_interest_amount": "0.00",
         "tracking_number": "74436",
         "carrier_shipping_code": null,
         "shipping_company": null,
         "shipment_code": null,
         "external_status": null,
         "discount_amount": "0.00",
         "retail_price": null,
         "attributes": {},
         "attributes_kwargs": {},
         "image": null
       }
     ],
     "channel": {
         "name": "Shop",
         "conf": {
             "server": "https://example-shop.com.tr/api/v1/"         
         }
     }
   }
 ]
}
```
