# Customer Services

All services related to customers are listed in this page.

### `GET` List Customers - Simple

This service is used to retrieve a list of customers.

It has been added for the purpose of supporting business intelligence.

**Path:** `/api/v1/oms/customers/list-simple/`

**Query Parameters**

The following query parameters can be used to get the details of customers.

| Parameter | Data Type | In     | Description                         |
| --------- | --------- | ------ | ----------------------------------- |
| token     | string    | header | The API key of the customer account |

**Example Request**

To get a simple list of all customers, a `GET` request should be sent to the `/api/v1/oms/customers/list-simple/` endpoint. In the headers, set the `Authorization` header to include the token for authentication.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{domain_url}/api/v1/oms/customers/list-simple/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Token {token}'
}

response = requests.request('GET', url, headers=headers)

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of 200 OK, the API returns the details of the customers. The response body contains a `JSON` object with the customers and their attributes such as ID, first name, last name etc.

These parameters are described in the following table.

| Parameter      | Data Type | Description                            |
| -------------- | --------- | -------------------------------------- |
| id             | integer   | The primary key of the customer        |
| created\_date  | date      | The creation date of the customer      |
| modified\_date | date      | The last modified date of the customer |
| omnitron\_id   | integer   | The omnitron id of the customer        |
| email          | string    | The email of the customer              |
| first\_name    | string    | The first name of the customer         |
| last\_name     | string    | The last name of the customer          |
| phone\_number  | string    | The phone number of the customer       |
| erp\_code      | string    | The partner customer code              |
| channel        | integer   | The channel id of the customer         |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
{
  "count": 109,
  "next": "https://{domain_url}/api/v1/oms/customers/list-simple/?page=2",
  "previous": null,
  "results": [
    {
      "id": 1,
      "created_date": "2023-10-06T08:42:53.427023Z",
      "modified_date": "2023-10-06T08:42:53.427050Z",
      "omnitron_id": 55,
      "email": "ali.test@akinon.com",
      "first_name": "Ali",
      "last_name": "Test",
      "phone_number": "05555554433",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 2,
      "created_date": "2023-09-05T13:36:59.653885Z",
      "modified_date": "2023-09-05T13:36:59.653913Z",
      "omnitron_id": 56,
      "email": "ipek.test@akinon.com",
      "first_name": "İpek",
      "last_name": "Test",
      "phone_number": "05555432100",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 3,
      "created_date": "2023-09-04T07:38:17.414588Z",
      "modified_date": "2023-09-04T07:38:17.414615Z",
      "omnitron_id": 57,
      "email": "ahmet.test@akinon.com",
      "first_name": "Ahmet",
      "last_name": "Test",
      "phone_number": "05454545454",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 4,
      "created_date": "2023-08-16T07:46:00.912768Z",
      "modified_date": "2023-09-13T11:20:37.500200Z",
      "omnitron_id": 60,
      "email": "tugce.test@akinon.com",
      "first_name": "Tuğçe",
      "last_name": "Test",
      "phone_number": null,
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 5,
      "created_date": "2023-08-07T11:36:47.556620Z",
      "modified_date": "2023-08-07T11:36:47.556641Z",
      "omnitron_id": 61,
      "email": "veli.test@akinon.com",
      "first_name": "Veli",
      "last_name": "Test",
      "phone_number": "05550005555",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 6,
      "created_date": "2023-06-19T12:16:44.195162Z",
      "modified_date": "2023-06-19T12:16:44.195190Z",
      "omnitron_id": 66,
      "email": "zeynep.test@akinon.com",
      "first_name": "Zeynep",
      "last_name": "Test",
      "phone_number": null,
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 7,
      "created_date": "2023-06-19T08:38:45.560031Z",
      "modified_date": "2023-06-19T08:38:45.560051Z",
      "omnitron_id": 70,
      "email": "mehmet.test@akinon.com",
      "first_name": "Mehmet",
      "last_name": "Test",
      "phone_number": "05556665544",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 8,
      "created_date": "2023-06-19T07:43:25.090872Z",
      "modified_date": "2023-06-19T07:52:42.410357Z",
      "omnitron_id": 81,
      "email": "fatma.test@gmail.com",
      "first_name": "Fatma",
      "last_name": "Test",
      "phone_number": "05555551122",
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 9,
      "created_date": "2023-06-14T09:56:48.842924Z",
      "modified_date": "2023-06-14T11:25:10.352066Z",
      "omnitron_id": 101,
      "email": "emre.test@gmail.com",
      "first_name": "Emre",
      "last_name": "Test",
      "phone_number": null,
      "erp_code": null,
      "channel": 1
    },
    {
      "id": 10,
      "created_date": "2023-06-06T08:39:22.332325Z",
      "modified_date": "2023-06-09T11:10:00.248909Z",
      "omnitron_id": 105,
      "email": "yilmaz.test@akinon.net",
      "first_name": "Yılmaz",
      "last_name": "Test",
      "phone_number": "05554440000",
      "erp_code": null,
      "channel": 1
    }
  ]
}
```

### `OPTIONS` List Customers - Simple

This service is used to retrieve API level details of customers.

**Path:** `/api/v1/oms/customers/list-simple/`

**Query Parameters**

The following query parameters can be used to get the details of the service.

| Parameter | Data Type | In     | Description                         |
| --------- | --------- | ------ | ----------------------------------- |
| token     | string    | header | The API key of the customer account |

**Example Request**

To get API level details of the service, a `OPTIONS` request should be sent to the `/api/v1/oms/customers/list-simple/` endpoint. In the headers, set the `Authorization` header to include the token for authentication.

Here's an example of how to make the request in python:

```python
import requests

url = "https://{domain_url}/api/v1/oms/customers/list-simple/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Token {token}'
}

response = requests.request('OPTIONS', url, headers=headers)

print(response.json())
```

**Example Response (200 OK)**

In a successful response with a status code of 200 OK, it returns the api level details of the service. The response body contains a `JSON` object with the name, rendering types, filtering attributes etc.

These parameters are described in the following table.

| Parameter | Data Type | Description                             |
| --------- | --------- | --------------------------------------- |
| name      | string    | The name of the service                 |
| renders   | list      | The rendering types of the service      |
| parses    | list      | The parsing types of the service        |
| actions   | json      | The defined actions of the service      |
| filters   | list      | The filtering attributes of the service |

This example response serves as a reference to understand the structure and data format returned from this API service.

```json
{
  "name": "list-simple",
  "renders": [
    "application/json",
    "text/csv",
    "application/xls"
  ],
  "parses": [
    "application/json",
    "application/x-www-form-urlencoded",
    "multipart/form-data"
  ],
  "actions": {
    "GET": {
      "id": {
        "type": "integer",
        "required": false,
        "read_only": true,
        "label": "ID"
      },
      "created_date": {
        "type": "datetime",
        "required": false,
        "read_only": true,
        "label": "Created date"
      },
      "modified_date": {
        "type": "datetime",
        "required": false,
        "read_only": true,
        "label": "Modified date"
      },
      "omnitron_id": {
        "type": "integer",
        "required": true,
        "read_only": false,
        "label": "Omnitron id",
        "min_value": -2147483648,
        "max_value": 2147483647
      },
      "email": {
        "type": "email",
        "required": true,
        "read_only": false,
        "label": "Email",
        "max_length": 254
      },
      "first_name": {
        "type": "string",
        "required": false,
        "read_only": false,
        "label": "First name",
        "max_length": 255
      },
      "last_name": {
        "type": "string",
        "required": false,
        "read_only": false,
        "label": "Last name",
        "max_length": 255
      },
      "phone_number": {
        "type": "string",
        "required": false,
        "read_only": false,
        "label": "Phone number",
        "max_length": 128
      },
      "erp_code": {
        "type": "string",
        "required": false,
        "read_only": false,
        "label": "Partner customer code",
        "max_length": 64
      },
      "channel": {
        "type": "pk field",
        "required": false,
        "read_only": false,
        "label": "Channel"
      }
    }
  },
  "filters": [
    {
      "label": "Sort",
      "field_name": "sort",
      "type": "dropdown",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "choices": [
          [
            "id",
            "ID"
          ],
          [
            "-id",
            "ID (descending)"
          ],
          [
            "modified_date",
            "Modified Date"
          ],
          [
            "-modified_date",
            "Modified Date (descending)"
          ]
        ],
        "help_text": "",
        "null_label": null,
        "required": false
      }
    },
    {
      "label": "Id Gt",
      "field_name": "id",
      "type": "integer",
      "lookup_expr": [
        "gt"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Id Gte",
      "field_name": "id",
      "type": "integer",
      "lookup_expr": [
        "gte"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Id Lt",
      "field_name": "id",
      "type": "integer",
      "lookup_expr": [
        "lt"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Id Lte",
      "field_name": "id",
      "type": "integer",
      "lookup_expr": [
        "lte"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "First Name",
      "field_name": "first_name",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Last Name",
      "field_name": "last_name",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Email",
      "field_name": "email",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Phone Number",
      "field_name": "phone_number",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Erp Code",
      "field_name": "erp_code",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Channel Id",
      "field_name": "channel_id",
      "type": "string",
      "lookup_expr": [
        "exact"
      ],
      "extra": {
        "required": false
      }
    },
    {
      "label": "Modified Date",
      "field_name": "modified_date",
      "type": "string",
      "lookup_expr": [
        "exact",
        "gt",
        "gte",
        "lt",
        "lte"
      ],
      "extra": {
        "required": false
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/oms/customer-services.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
