> This is part 1 of 9 of the full documentation (pages 1–100 of 887).
> The content is paginated: fetch every part to see all of it.
> Next part: https://apidocs.akinon.com/llms-full.txt/1
> Page index: https://apidocs.akinon.com/llms.txt

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
This site has an agentic ask interface you may use to query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/index.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

---

# Welcome to Akinon Documentation

Empowering Progress, Elevating Possibilities: Akinon Documentation guides you through the modernization of client infrastructure with state-of-the-art technology and expert multilingual support.

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:red;"><strong>Quick Start</strong></mark></td><td>Ignite Your Project: Hit the Ground Running with Quick Start.</td><td><a href="https://akinon-poc.gitbook.io/developers-akinon-documentation">https://akinon-poc.gitbook.io/developers-akinon-documentation</a></td></tr><tr><td><mark style="color:red;"><strong>API Reference</strong></mark></td><td>Unlock the Code: Get Creative with Our API Guides.</td><td><a href="https://akinon-poc.gitbook.io/home/api-reference/">https://akinon-poc.gitbook.io/home/api-reference/</a></td></tr><tr><td><mark style="color:red;"><strong>Tutorials</strong></mark></td><td>Step-by-Step to Success: Tips and Comprehensive Tutorials.</td><td><a href="https://akinon-poc.gitbook.io/developers-akinon-documentation/tutorials">https://akinon-poc.gitbook.io/developers-akinon-documentation/tutorials</a></td></tr><tr><td><mark style="color:red;"><strong>Technical Guides</strong></mark></td><td>Master the Mechanics: Explore Deep Insights with Technical Guides.</td><td><a href="https://akinon-poc.gitbook.io/developers-akinon-documentation/technical-guides">https://akinon-poc.gitbook.io/developers-akinon-documentation/technical-guides</a></td></tr><tr><td><mark style="color:red;"><strong>Release Notes</strong></mark></td><td>Dive into Innovation: Unveiling What is New in Release Notes.</td><td><a href="https://akinon-poc.gitbook.io/developers-akinon-documentation/release-notes">https://akinon-poc.gitbook.io/developers-akinon-documentation/release-notes</a></td></tr><tr><td><mark style="color:red;"><strong>Glossary</strong></mark></td><td>Explore Knowledge in Depth with Our Glossary of Terms.</td><td><a href="https://akinon-poc.gitbook.io/developers-akinon-documentation/glossary">https://akinon-poc.gitbook.io/developers-akinon-documentation/glossary</a></td></tr></tbody></table>


# Getting Started

## <mark style="color:red;">Akinon Commerce Cloud Products</mark>

Akinon Commerce Cloud (ACC) is a comprehensive Platform as a Service (PaaS) designed to deliver seamless omnichannel commerce experiences. Our integrated suite of products works together to provide end-to-end solutions for modern retail and e-commerce businesses:

1. **Akinon Omnitron** - Product Information and Catalog Management System with powerful Channel Management. Akinon Omnitron provides centralized management of product data, pricing, inventory, and sales channels to ensure consistent information across all touch points.
   * **Example flow**: When a product manager updates pricing in Omnitron, the changes automatically propagate to all connected sales channels, ensuring consistency across web, mobile, and physical store displays.
2. **Akinon Commerce** - Feature-rich e-commerce storefront platform with multi-language support for global reach. Delivers exceptional customer experiences through customizable, responsive storefronts with advanced search and personalization capabilities. Provides headless API capabilities for storefronts, enabling flexible front-end implementations across multiple channels and devices.
   * **Example flow**: A customer browses products on the storefront, adds items to cart, and completes checkout on desktop later—with their cart state preserved seamlessly across devices.
3. **Akinon OMS** (Order Management System) - Advanced system for inventory allocation and intelligent order routing. Optimizes fulfillment processes by intelligently managing orders across multiple warehouses and retail locations.
   * **Example flow**: When an order is placed, OMS automatically determines the optimal fulfillment location based on inventory levels, proximity to customer, and delivery options selected.
4. **Akinon Instore App** - Specialized solution for in-store fulfillment and seamless physical retail integration. Connects brick-and-mortar stores to the digital ecosystem, enabling services like click-and-collect and endless aisle.
   * **Example flow**: A store associate uses the Instore App to process click-and-collect orders, access customer profiles with purchase history, and enable "endless aisle" checkout for items not available in-store but accessible through the company's broader inventory network.
5. **Akinon Native AppBuilder** - Powerful toolkit for building custom mobile applications that extend your commerce experience. Creates engaging mobile experiences that drive customer loyalty and increase conversion rates.
   * **Example flow**: Developers use AppBuilder to create a branded mobile shopping experience with custom loyalty features that sync with the core commerce platform.
6. **Akinon Integrator** – Akinon Integrator is a middleware platform that enables seamless data exchange between Akinon Commerce Cloud and external systems like ERPs. It supports the synchronization of product data, stock, pricing, images, and order information through configurable flows. With built-in logging, alerting, and performance monitoring, Integrator ensures reliable and traceable integration operations.
   * **Example flow**: A merchant uses Integrator to sync product and stock data from an ERP system to Omnitron. The Integrator receives the data via a scheduled flow, transforms it to match Omnitron's schema, and pushes it automatically—ensuring real-time accuracy across systems.
7. **Akinon Seller Center** – Akinon Seller Center is a modular platform designed for marketplace owners (MPOs) and third-party sellers to manage products, orders, inventory, and campaigns within the Akinon ecosystem. It offers role-based access, real-time data sync with Omnitron, and tools for catalog updates, order fulfillment, and performance tracking—enabling efficient marketplace operations and seller collaboration.
   * **Example flow**: A seller creates an offer for an existing marketplace product in Seller Center. The offer is submitted for MPO (Marketplace Owner) approval. After the MPO approves the offer, it is synced to Omnitron under the corresponding marketplace product. Once synced, the seller’s offer becomes visible on the marketplace and can be purchased by customers.
8. **Akifast** – Akifast is a next-generation payment gateway that simplifies and secures online transactions across multiple merchants with a single user registration. Shoppers can save their card and address details once and enjoy fast, seamless checkouts on any Akifast-integrated store—no need to re-enter information.
   * **Example flow**: A user selects Akifast at checkout, completes the payment on the hosted payment page using saved details, and the merchant sees the transaction instantly reflected in the merchant dashboard.

These products are delivered as cloud services through the Akinon Commerce Cloud (ACC) platform, which is a PaaS (Platform as a Service) environment designed for omnichannel commerce experiences.

### <mark style="color:red;">Product Capabilities Comparison</mark>

<table><thead><tr><th width="139.36328125">Product</th><th width="157.2109375">Primary Function</th><th width="212.42578125">Key Capabilities</th><th>Integration Points</th></tr></thead><tbody><tr><td><strong>Omnitron</strong></td><td>Product &#x26; Catalog Management</td><td>Product data, pricing, inventory management</td><td>Feeds all channels with product data</td></tr><tr><td><strong>Commerce</strong></td><td>Customer-facing Storefront</td><td>Headless Commerce, search, checkout, headless API</td><td>Consumes data from Omnitron, provides headless API for custom frontends</td></tr><tr><td><strong>OMS</strong></td><td>Order Fulfillment</td><td>Order routing, inventory allocation, fulfillment</td><td>Receives orders from Omnitron, connects with Instore</td></tr><tr><td><strong>Instore App</strong></td><td>Physical Retail Operations</td><td>Click-and-collect, endless aisle, in-store fulfillment</td><td>Connects with OMS and Omnitron, Commerce</td></tr><tr><td><strong>Native AppBuilder</strong></td><td>Mobile Experience</td><td>Branded apps, loyalty features, mobile checkout</td><td>Connects with Commerce as custom storefront</td></tr><tr><td><strong>Integrator</strong></td><td>Data Synchronization &#x26; Flows</td><td>Syncs data between ERP and Omnitron (products, stock, orders), logging, alerting</td><td>Connects ERP with Omnitron, Whippy and optionally OMS; handles S3 image integration</td></tr><tr><td><strong>Seller Center</strong></td><td>Marketplace Seller Management</td><td>Product onboarding, order tracking, campaign participation, role-based access</td><td>Integrates with Omnitron and Commerce; used by MPOs and third-party sellers</td></tr><tr><td><strong>Akifast</strong></td><td>Payment Processing</td><td>Hosted Payment Page, Smart Switch, One Shot Default, secure data storage</td><td>Integrates with Commerce and Merchant systems; provides shared user checkout system</td></tr></tbody></table>

### <mark style="color:red;">API Ecosystem Overview</mark>

Akinon Commerce Cloud offers two primary types of APIs:

1. **Admin/Management APIs** - Accessed through Omnitron API Gateway, these APIs provide administrative capabilities with elevated permissions. They enable company staff and third-party applications to manage all aspects of the platform.
   * **Common use cases**: Product catalog updates, inventory management, order processing, price changes, promotion setup, user permission management
   * **Access pattern**: Authenticated with Admin Token, typically used in back-office operations
2. **Customer APIs** - Provided by the Commerce Application, these APIs operate within the context of customer sessions and are specifically designed for end-customers to interact with their own data. They power storefronts and customer-facing applications, delivering secure access to personal information, order history, and product catalogs while enforcing appropriate access controls. These APIs are optimized for exceptional performance in high-traffic consumer applications, ensuring fast response times and a seamless user experience. Customer APIs enable personalized shopping experiences while maintaining robust security and data privacy standards.
   * **Common use cases**: Product browsing, shopping cart management, checkout process, order status checking, customer profile management
   * **Access pattern**: Authenticated within customer session context, typically used in storefront applications
   * **Headless capabilities**: The Customer APIs form the foundation of Akinon's headless commerce architecture, allowing developers to build custom frontend experiences using any technology stack while leveraging the robust commerce capabilities of the Akinon platform.

## <mark style="color:red;">Akinon API Reference</mark>

Akinon API Reference provides a modern, interactive experience for developers to explore, test, and integrate Akinon’s RESTful APIs. Built on the **OpenAPI specification**, our documentation offers detailed endpoint definitions, request/response schemas, and example payloads—enabling faster development and easier onboarding.

All Akinon APIs follow REST architectural principles and communicate over HTTP using standard methods like:

* `GET` — Retrieve data
* `POST` — Create new resources
* `PUT` / `PATCH` — Update existing resources
* `DELETE` — Remove resources
* `OPTIONS` — Discover communication options for a given endpoint

### <mark style="color:red;">Key Features</mark>

* **Interactive API Console**\
  You can test all endpoints directly within the documentation platform using the built-in “**Test it**” feature. This lets you authenticate, send real requests, and inspect live responses—without switching tools.
* **Comprehensive Endpoint Coverage**\
  Each API endpoint includes detailed information on request parameters, data models, response types, status codes, and error handling to help you build reliable and robust integrations.
* **Continuously Updated**\
  API references are actively maintained and reflect the latest changes, new features, and improvements across Akinon’s products.

Whether you're retrieving product data, syncing inventory, managing orders, or processing payments, Akinon’s OpenAPI-powered reference ensures you have everything you need to build scalable and integrated commerce experiences.


# Omnitron


# Getting Started

All Akinon API responses are formatted in JSON. API is served over HTTPS to ensure data privacy, unencrypted HTTP is not supported.

```code
Base URL : https://{omnitron_url}/api/i1/
```

`{omnitron_url}` is the domain name of a customer's Omnitron. For example, akinon.omnitron.net

Akinon Omnitron API and its other products use your Omnitron account for authentication. If you don't have an account yet, you can get in touch with a partner manager for [Akinon Omnitron Account](https://www.akinon.com/partner-program).

## <mark style="color:red;">API Authentication</mark>

All requests to Akinon's REST API need to be authenticated. To begin using the Akinon APIs, you will need to generate an API key with Login API. All other requests should be sent with the token response from the API key generated by Login API.

{% hint style="warning" %}
Make sure that Content-Type:application/json is in the header of each request.
{% endhint %}

| **Parameter** | **Data Type** | **Description**          |
| ------------- | ------------- | ------------------------ |
| `username`    | string        | Akinon Omnitron Username |
| `password`    | string        | Akinon Omnitron Password |

### <mark style="color:red;">Request POST</mark>

You need to issue an HTTPS POST to a login url in order to get an API key.

`Content_Type` header represents the response type.

Body requests must contain a `username` and a `password`.

```python
import requests
import json
url = "https://{customer_api_url}/api/i1/auth/login/"
headers = {
    'Content-Type': 'application/json'
}
data = {
    'username': 'Omnitron Username',
    'password': 'Omnitron Password'
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)
```

#### Response

The response returns an API key. This key is required to be used in other resources. The return key must be added in headers of any requests as `Authorization`: `Token {}`.format(api\_token).

```json
{
    "key": "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
}
```

Resource Properties are in Python format:

| **Parameter** | **Data Type** | **Description**                     |
| ------------- | ------------- | ----------------------------------- |
| key           | string        | The API key of the customer account |


# Integration


# Product


# Product

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle products. By leveraging these methods, users can retrieve, create, update, and search products, allowing for seamless integration and management of product data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product API.

## <mark style="color:red;">Get Products</mark>

Retrieves products from the system. For filtering the results, check the “Product Search” section.

| **Parameter** | **Data Type** | **In** | **Description**                                                    |
| ------------- | ------------- | ------ | ------------------------------------------------------------------ |
| api\_token    | string        | header | [The API key of the customer’s account](/omnitron/getting-started) |
| limit         | integer       | query  | Amount of items per page that will be returned                     |
| page          | string        | query  | Page number to return                                              |

{% hint style="warning" %}
If **limit** and **page** parameters are not sent, response returns 10 products by default.
{% endhint %}

#### <mark style="color:red;">**Request GET**</mark>

Retrieves all of the products in the system.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘Accept-language’ header determines translatable fields responses.

**Path:** `products/`

```json

import requests

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

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-language':'en-us'
}

params = {
    'limit': '2',
    'page': '1'
}

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

```

#### **Response**

Response contains all product data. Resource properties are in Python format.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines if the product is active or passive                                                                                                            |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |
| key                    | dict          | Attribute name attached to the product                                                                                                                 |
| value                  | string        | Attribute value attached to the product                                                                                                                |
| data\_type             | string        | Attribute data type attached to the product                                                                                                            |
| label                  | string        | Attribute label attached to the product                                                                                                                |
| extra\_attributes      | dict          | Additional attributes                                                                                                                                  |

“count” shows how many products exist in the system.

“next” shows the next cursor url to retrieve the desired products.

“previous” shows the previous cursor url to retrieve the desired products.

“results” shows every product detail.

```python

{
  "count": 298501,
  "next": "https://{customer_api_url}/api/i1/products/?limit=2&page=2",
  "previous": null,
  "results": [
    {
      "id": 3,
      "name": "Guitar",
      "base_code": "1020583",
      "sku": "1020583031",
      "product_type": "0",
      "is_active": true,
      "custom_attribute_set": 480,
      "attribute_set": 151,
      "attributes": {},
      "attributes_kwargs": {},
      "extra_attributes": {},
    },
    {
      "id": 43,
      "name": "Orchid Flower",
      "base_code": "1184770",
      "sku": "1184770001",
      "product_type": "0",
      "is_active": true,
      "custom_attribute_set": null,
      "attribute_set": 7,
      "attributes": {
        "varyant_size": "36",
        "airway_volume": "1"
      },
      "attributes_kwargs": {
        "varyant_size": {
          "value": "36",
          "data_type": "dropdown",
          "label": "36"
        }
      },
      "extra_attributes": {},
    }
  ]
}

```

## <mark style="color:red;">Get Product Detail</mark>

To be able to retrieve the product details, a user needs to know the SKU of the product.

| **Parameter** | **Data Type** | **In** | **Description**                                                    |
| ------------- | ------------- | ------ | ------------------------------------------------------------------ |
| api\_token    | string        | header | [The API key of the customer’s account](/omnitron/getting-started) |
| {"sku"}       | integer       | query  | Product SKU                                                        |

#### <mark style="color:red;">**Request GET**</mark>

Retrieves an instance detail of the product.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path:`products/{sku}`

```python

import requests

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

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

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

```

#### **Response**

Response contains all product details data.

The explanation of the fields in the response body is provided in the table below.

Resource properties are in Python format.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines if the product is active or passive                                                                                                            |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |

```json

{
  "id": 49,
  "name": "Orchid Flower 80 x 35 CM",
  "base_code": "1185158",
  "sku": "1185158001",
  "product_type": "0",
  "is_active": true,
  "custom_attribute_set": null,
  "attribute_set": 7,
  "attributes": {
    "erp_ProductDetailName": "Flower",
    "integration_OriginalColor": "Colorless",
    "integration_ProductionPlace": "China",
    "erp_Size": "000",
    "integration_Lenght": "35.0",
    "integration_Description": "<p> </p><p>Width: 35</p><p>Size: 80</p><p>Hight: 0</p><p>Origin: China</p>",
    "color": "colorless",
    "erp_PrimaryColor": "X",
    "integration_SizeHeight": "0.0",
    "size_height": "0.0",
    "erp_SizeWidth": "35.0",
    "erp_SizeHeight": "80.0",
    "erp_Season": "Continuous",
    "integration_Gender": "General",
    "erp_ProductClassName": "PLANT GROUP",
    "erp_Msb": "False",
    "erp_ProductGroupName": "CONCEPT",
    "integration_ModelNo": "None",
    "integration_MainProductType": "0",
    "variant_color": "colorless",
    "erp_ProductionPlace": "China",
    "erp_Description": "<p> </p><p>Width: 35</p><p>Size: 80</p><p>Hight: 0</p><p>Origin: China</p>",
    "size_weight": "0.0",
    "integration_Outlet": "False",
    "erp_ProductSubGroupName": "DECORATIVE",
    "airway_volume": "1",
    "integration_Year": "2017",
    "integration_SizeWeight": "0.0",
    "integration_Size": "000",
    "erp_MainProductType": "0",
    "adjust-attempt": "cms/2020/06/29/2086b0fe-1d47-4647-98f6-dcf886c93efc.jpg",
    "integration_TechnicalDetail": "None",
    "integration_Season": "Continuous",
    "size": "Standart",
    "erp_SizeHeight": "0.0",
    "erp_VariantNo": "1185158-000",
    "erp_SizeWeight": "0.0",
    "size_width": "35.0",
    "integration_ProductSubGroupName": "Flower Group",
    "integration_PrimaryColor": "X",
    "erp_Outlet": "False",
    "integration_ProductDetailName": "POTTED FLOWERS",
    "integration_Msb": "False",
    "integration_ProductSubGroupName": "DECORATIVE",
    "erp_PrimaryColor": "Colorless",
    "integration_SizeHeight": "80.0",
    "size_height": "80.0",
    "erp_ProductSubGroupName": "Flower Group",
    "gender": "General",
    "erp_Gender": "General",
    "integration_Product": "PLANT GROUP",
    "integration_VariantNo": "1185158-000",
    "integration_ProductGroupName": "CONCEPT",
    "erp_Year": "2017"
  },
  "attributes_kwargs": {
    "erp_ProductDetailName": {
      "value": "POTTED FLOWERS",
      "data_type": "dropdown",
      "label": "POTTED FLOWERS"
    },
    "adjust-attempt": {
      "url": "https://akinon.akinoncdn.com/cms/2020/06/29/2086b0fe-1d47-4647-98f6-dcf886c93efc.jpg",
      "value": "cms/2020/06/29/2086b0fe-1d47-4647-98f6-dcf886c93efc.jpg",
      "data_type": "image"
    },
    "erp_Msb": {
      "value": "False",
      "data_type": "dropdown",
      "label": "False"
    },
    "erp_PrimaryColor": {
      "value": "X",
      "data_type": "dropdown",
      "label": "X"
    },
    "erp_Size": {
      "value": "000",
      "data_type": "dropdown",
      "label": "000"
    },
    "erp_MainProductType": {
      "value": "0",
      "data_type": "dropdown",
      "label": "0"
    },
    "color": {
      "value": "COLORLESS",
      "data_type": "dropdown",
      "label": "COLORLESS"
    },
    "variant_color": {
      "value": "COLORLESS",
      "data_type": "dropdown",
      "label": "COLORLESS"
    },
    "size": {
      "value": "Standard",
      "data_type": "dropdown",
      "label": "Standart"
    },
    "erp_ProductionPlace": {
      "value": "CHINA",
      "data_type": "dropdown",
      "label": "CHINA"
    },
    "erp_Outlet": {
      "value": "False",
      "data_type": "dropdown",
      "label": "False"
    },
    "gender": {
      "value": "General",
      "data_type": "dropdown",
      "label": "General"
    },
    "erp_ProductSubClassName": {
      "value": "FLOWER GROUP",
      "data_type": "dropdown",
      "label": "FLOWER GROUP"
    },
    "erp_Gender": {
      "value": "General",
      "data_type": "dropdown",
      "label": "General"
    },
    "erp_ProductClassName": {
      "value": "FLOWER GROUP",
      "data_type": "dropdown",
      "label": "FLOWER GROUP"
    },
    "erp_PrimaryColor": {
      "value": "COLORLESS",
      "data_type": "dropdown",
      "label": "COLORLESS"
    },
    "erp_ProductGroupName": {
      "value": "CONCEPT",
      "data_type": "dropdown",
      "label": "CONCEPT"
    },
    "erp_ProductSubGroupName": {
      "value": "DECORATIVE",
      "data_type": "dropdown",
      "label": "DECORATIVE"
    }
  },
  "extra_attributes": {}
}

```

## <mark style="color:red;">Search Product</mark>

GET request is used to search the products based on the provided parameters. If you don't add parameters for the filter, all products in the system will be returned. The filtering options are listed in the table below.

| **Parameter** | **Data Type** | **In** | **Description**                                                                                                                                        |
| ------------- | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| api\_token    | string        | header | [The API key of the customer’s account](/omnitron/getting-started)                                                                                     |
| limit         | integer       | data   | Amount of line items per page that will be returned                                                                                                    |
| page          | integer       | data   | Page number to return                                                                                                                                  |
| name          | string        | data   | Product name                                                                                                                                           |
| product\_type | integer       | data   | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active    | boolean       | body   | True or False                                                                                                                                          |
| sku           | string        | data   | Stock keeping unit                                                                                                                                     |

#### <mark style="color:red;">**Request GET**</mark>

This sample request is for filtering products based on their SKU and name.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘Accept-language’ header determines translatable fields responses.

**Path:** `products/`

```python
import requests

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

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-language':'en-us'
}

params = {
    #'sku':'1020170001'
    'name': 'Sofa'
}

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

#### **Response**

Response contains all product data with search parameters. Response status is expected to be HTTP-200 Successful.

The table below shows the response properties in Python format. Every field has been explained in the description section of the table.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines if the product is active or passive                                                                                                            |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |
| key                    | dict          | Attribute name attached to the product                                                                                                                 |
| value                  | string        | Attribute value attached to the product                                                                                                                |
| data\_type             | string        | Attribute data type attached to the product                                                                                                            |
| label                  | string        | Attribute label attached to the product                                                                                                                |
| extra\_attributes      | dict          | Additional attributes                                                                                                                                  |

“count” shows how many products exist in the system.

“next” shows the next cursor url to retrieve the desired products.

“previous” shows the previous cursor url to retrieve the desired products.

“results” shows product’s every detail.

```json

{
  "count": 2,
  "next": "{customer_api_url}/api/i1/products/?name=Sofa&page=2",
  "previous": null,
  "results": [
    {
      "id": 14249,
      "name": "Example SOFA - 121x106 cm",
      "base_code": "1020170",
      "sku": "1020170001",
      "product_type": "0",
      "is_active": true,
      "custom_attribute_set": null,
      "attribute_set": 8,
      "attributes": {
        "erp_DetailName": "SOFA",
        "erp_TechnichDetail": "%100 Ferforje",
        "integration_Origin": "China",
        "erp_Size": "000",
        "integration_Width": "121.0",
        "color": "Colorless",
        "integration_Heighth": "106.0",
        "size_height": "106.0",
        "size_width": "121.0",
        "erp_depth": "48.0",
        "integration_gender": "General",
        "erp_ModelNo": "157A027005",
        "erp_groupname": "CONCEPT",
        "integration_ModelNo": "157A027005",
        "erp_Year": "2007"
      },
      "attributes_kwargs": {
        "erp_MainColor": {
          "value": "X",
          "data_type": "dropdown",
          "label": "X"
        },
        "erp_Size": {
          "value": "000",
          "data_type": "dropdown",
          "label": "000"
        },
        "color": {
          "value": "COLORLESS",
          "data_type": "dropdown",
          "label": "COLORLESS"
        },
        "size": {
          "value": "Standart",
          "data_type": "dropdown",
          "label": "Standart"
        },
        "erp_Origin": {
          "value": "China",
          "data_type": "dropdown",
          "label": "China"
        },
        "gender": {
          "value": "General",
          "data_type": "dropdown",
          "label": "General"
        },
        "erp_groupname": {
          "value": "CONCEPT",
          "data_type": "dropdown",
          "label": "CONCEPT"
        }
      },
      "extra_attributes": {}
    },
    {
      "id": 15081,
      "name": "LOREM SOFA NATUREL 260X126X80CM",
      "base_code": "1021564",
      "sku": "1021564001",
      "product_type": "0",
      "is_active": false,
      "custom_attribute_set": null,
      "attribute_set": 8,
      "attributes": {
        "erp_DetailName": "SOFA",
        "integration_Origin": "VİETNAM",
        "erp_Size": "000",
        "integration_Width": "0.0",
        "color": "Colorless",
        "integration_Heighth": "0.0",
        "size_height": "0.0",
        "size_width": "0.0",
        "size_depth": "0.0",
        "integration_gender": "Genel",
        "erp_ModelNo": "029A028010",
        "erp_MalGrupAdi": "CONCEPT",
        "integration_ModelNo": "029A028010",
        "gender": "General",
        "erp_Cinsiyet": "General",
        "erp_groupname": "CONCEPT",
        "erp_Year": "2008"
      },
      "attributes_kwargs": {
        "erp_Size": {
          "value": "000",
          "data_type": "dropdown",
          "label": "000"
        },
        "color": {
          "value": "COLORLESS",
          "data_type": "dropdown",
          "label": "COLORLESS"
        },
        "size": {
          "value": "Standart",
          "data_type": "dropdown",
          "label": "Standart"
        },
        "erp_Origin": {
          "value": "China",
          "data_type": "dropdown",
          "label": "China"
        },
        "gender": {
          "value": "General",
          "data_type": "dropdown",
          "label": "General"
        },
        "erp_groupname": {
          "value": "CONCEPT",
          "data_type": "dropdown",
          "label": "CONCEPT"
        }
      },
      "extra_attributes": {}
    }
  ]
}

```

## <mark style="color:red;">Create Product</mark>

This service has upsert logic. If a given ‘product\_sku’ exists in the system, the product will be updated with the given parameters. If there is no matching `product_sku`, a new product will be created.

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2Fn2rkX0qCcbNzB3x8u69S%2Fimage.png?alt=media&amp;token=2311165e-a94c-48b2-b0e7-fc5a1674e138" alt="" width="303"><figcaption><p>Fig 1: Create Product Decision Flowchart</p></figcaption></figure>

**Note:** Before a product is created, the required attribute values for color and size must be created.

| **Parameter**          | **Data Type** | **In**  | **Required** | **Description**                                                                                                                                                   |
| ---------------------- | ------------- | ------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api\_token             | string        | header  | YES          | [The API key of the customer’s account](/omnitron/getting-started)                                                                                                |
| django\_language       | string        | cookies |              | Language [code](http://www.lingoes.net/en/translator/langcode.htm) for translation                                                                                |
| name                   | string        | body    | YES          | Product name                                                                                                                                                      |
| base\_code             | dict          | body    | YES          | Product base code                                                                                                                                                 |
| sku                    | string        | body    | YES          | Stock keeping unit                                                                                                                                                |
| product\_type          | enum          | body    | YES          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4)            |
| is\_active             | boolean       | body    |              | Defines if the product is active or passive. If the parameter is False, the product is removed from all sales channels.                                           |
| attribute\_set         | id            | body    | YES          | ID of the related attribute set                                                                                                                                   |
| attributes             | dict          | body    |              | Attribute list                                                                                                                                                    |
| custom\_attribute\_set | integer       | body    |              | Additional attribute set ID                                                                                                                                       |
| attributes\_kwargs     | dict          | body    |              | Details of the attributes attached to the product                                                                                                                 |
| extra\_attributes      | dict          | body    | YES          | This parameter is used neither in the backend (Omnitron) nor on the website. It can be used as an additional attribute note such as attribute ID in the ERP side. |

If Attribute type is ‘text’ or ‘text\_area’ and the attribute will be used in a different language, ‘is\_localizable’ parameter should be *True*. In order to send language translation for an attribute, the `Accept-Language` parameter needs to be added to the header. `Accept-Language` parameter is an optional parameter. If it is not sent, Omnitron's default language will be defined.

**Note:** Before sending language translation for a product, the product must be first created in Omnitron's default language.

#### <mark style="color:red;">**Request POST**</mark>

POST request is used to create a new product.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

In this example, the product will be created in Turkish ("tr-tr"), which is Omnitron's default language.

**Path:** `products/`

```python

import requests
import json

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

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

data = {
    'base_code': '1020583001',
    'sku': '102058302219001',
    'product_type': '0',
    'name': 'Sofa Adi',
    'is_active': True,
    'attribute_set': 644,
    'attributes': {
        'akinon_filterable_size':'L',
        'brand':'Adidas',
        },
    'extra_attributes': {}
}

response = requests.post(url, headers=headers,data=json.dumps(data))
print(response.text)

```

#### **Response**

Returns the created product data. Response status is expected to be HTTP-201 Created.

Resource properties are in Python format.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id                     | int           | Product ID                                                                                                                                             |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines whether the product is active or passive                                                                                                       |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |
| extra\_attributes      | dict          | Additional attributes                                                                                                                                  |

```json

{
  "id": 357467,
  "name": "Sofa Adi",
  "base_code": "1020583001",
  "sku": "102058302219001",
  "product_type": "0",
  "is_active": true,
  "custom_attribute_set": null,
  "attribute_set": 644,
  "attributes": {
    "brand": "Adidas",
    "akinon_filterable_size": "L"
  },
  "attributes_kwargs": {
    "akinon_filterable_size": {
      "value": "L",
      "data_type": "dropdown",
      "label": "L"
    }
  },
  "extra_attributes": {}
}

```

#### <mark style="color:red;">**Request POST**</mark>

POST request is used to create a new product.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

In this example, the product will be updated with the second language - English ("en-us"), therefore we need to use the `django_language` field or the `Accept-Language` header.

Path: `products/`

```python

import requests
import json

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

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

cookies = {
    'django_language':'en-us'
}

data = {
    'base_code': '1020583',
    'sku': '102058302219',
    'product_type': '0',
    'name': 'Sofa EN',
    'is_active': True,
    'attribute_set': 151,
    'language':'en-us',
    'attributes': {
        'color': '0001',
        'description':'cotton sofa',
        'attribute_set': "151",
        'erp_color': "22",
        'erp_define': "single sofa",
        'erp_pattern': "009",
        'erp_brand': "096",
        },
    
    'extra_attributes': {}
}

response = requests.post(url, headers=headers, cookies=cookies , data=json.dumps(data))
print(response.text)

```

#### **Response**

Returns the created product data. Response status is expected to be HTTP-201 Created. Resource properties are in Python format.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id                     | int           | Product ID                                                                                                                                             |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines if the product is active or passive                                                                                                            |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |
| extra\_attributes      | dict          | Additional attributes                                                                                                                                  |

```json

{
  "id": 357170,
  "name": "Sofa EN",
  "base_code": "1020583",
  "sku": "102058302219",
  "product_type": "0",
  "is_active": true,
  "custom_attribute_set": null,
  "attribute_set": 151,
  "attributes": {
    "l_name": "Sofa EN"
  },
  "attributes_kwargs": {},
  "extra_attributes": {}
}

```

### <mark style="color:red;">Language Support</mark>

To create products with translations, you need to add an `Accept-Language` header. The given language in the header determines the translatable fields behavior. ‘Name’ and ‘attributes’ that have `is_localizable` parameter *True* (Check the Attributes section for more info) are translatable. Users can add other language behavior by updating products with a desirable language.

#### <mark style="color:red;">**Request POST**</mark>

Below request creates a product and their translatable fields in the English language.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘Accept-language’ header determines translatable fields responses.

Path:`products/`

```python

import requests
import json

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

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
    'Accept-Language': 'en-us'

}

data = {
    'base_code': '1020583',
    'sku': '1020583099',
    'product_type': '0',
    'name': 'Test Rock Guitar',
    'is_active': True,
    'attribute_set': 151,
    'attributes': {
        'color': 'blue',
    },
    'extra_attributes': {}
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

#### **Response**

Response contains all product data. Response status is expected to be HTTP-201 Created.

```json
{
  "id": 357103,
  "name": "Test Rock Guitar",
  "base_code": "1020583",
  "sku": "1020583099",
  "product_type": "0",
  "is_active": true,
  "custom_attribute_set": null,
  "attribute_set": 151,
  "attributes": {},
  "attributes_kwargs": {},
  "extra_attributes": {}
}

```

## <mark style="color:red;">Update Product</mark>

Updates the existing product based on its SKU by setting updated values of the parameters. How to get an SKU and other details are explained under [Search Product](broken://pages/YstmtEXYBMZyqWQI5s3b) section.

| **Property**           | **Data Type** | **In** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| api\_token             | string        | header | [The API key of the customer’s account](/omnitron/getting-started)                                                                                     |
| name                   | string        | body   | Product name                                                                                                                                           |
| base\_code             | dict          | body   | Product base code                                                                                                                                      |
| sku                    | string        | body   | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | body   | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | body   | Defines if the product is active or passive. If it is passive, the product is removed from all sales channels.                                         |
| attribute\_set         | id            | body   | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | body   | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | body   | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | body   | Details of the attributes attached to the product                                                                                                      |
| extra\_attributes      | dict          | body   | Additional attributes                                                                                                                                  |

#### <mark style="color:red;">**Request POST**</mark>

Sample POST request for updating a product is shown below. It is an update request since the given SKU already exists in the system.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path:`products/`

```python

import requests
import json

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

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

data = {
    'base_code': '1020583',
    'sku': '1020583099',
    'product_type': '0',
    'name': 'Test Rock Guitar',
    'is_active': True,
    'attribute_set': 151,
    'attributes': {
        'color': 'blue',
    },
    'extra_attributes': {}
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

#### **Response**

Returns the updated product fields. The table below shows the response properties in Python format. Every field has been explained in the description section of the table.

| **Property**           | **Data Type** | **Description**                                                                                                                                        |
| ---------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id                     | int           | Product ID                                                                                                                                             |
| name                   | string        | Product name                                                                                                                                           |
| base\_code             | dict          | Product base code                                                                                                                                      |
| sku                    | string        | Stock keeping unit                                                                                                                                     |
| product\_type          | enum          | [Product type](https://docs.akinon.com/technical-guides/omnitron/product-types) (simple: 0, product\_meta: 1, bundle: 2, grouped: 3, miscellaneous: 4) |
| is\_active             | boolean       | Defines if the product is active or passive                                                                                                            |
| attribute\_set         | id            | ID of the related attribute set                                                                                                                        |
| attributes             | dict          | Attribute list                                                                                                                                         |
| custom\_attribute\_set | integer       | Additional attribute set ID                                                                                                                            |
| attributes\_kwargs     | dict          | Details of the attributes attached to the product                                                                                                      |
| extra\_attributes      | dict          | Additional attributes                                                                                                                                  |

```json

{
  "id": 357103,
  "name": "Test Rock Guitar",
  "base_code": "1020583",
  "sku": "1020583099",
  "product_type": "0",
  "is_active": true,
  "custom_attribute_set": null,
  "attribute_set": 151,
  "attributes": {},
  "attributes_kwargs": {},
  "extra_attributes": {}
}

```


# Pre-Product

Within the pre-product domain, two distinct product types will be taken into consideration: **Pre-Product** and **Pre-Miscellaneous**.

The products integrated into the system undergo serialization using the `PreProductViewSet` before being inserted into the product table. During this insertion process, they are assigned either the values of `ProductTypes.pre_product` or `ProductTypes.pre_miscellaneous` for the `Products.product_type` parameter.

A signal is generated with every commit made to the Product table, and these signals are monitored by the `product_receiver {omnitron.products.receivers.product_receiver()}`. This receiver disregards commits with product types `pre_product` and `pre_miscellaneous`.

After every product commit that comes before actualization, it will be updated with `PreProductViewSet`, and during the update process, it will be actualized based on the value of `approved=True`.

**pre\_product​**

It is a simple product that comes before productization. When productized, it will take the value `ProductTypes.simple` as the `product_type`.

**pre\_miscellaneous​**

It is a non-saleable product that comes before productization. When productized, it will take the value `ProductTypes.miscellaneous` as the `product_type`. Non-saleable products can be found in the cart, but their direct sales are prohibited (for example, shopping bags).

## <mark style="color:red;">Serializer​</mark> <a href="#serializer" id="serializer"></a>

The `PreProductSerializer {omnitron.products.resources.serializers.PreProductSerializer}` extends the `ProductSerializer`, but it includes additional fields that are different from the `ProductSerializer` and are not present in the model: `approved:BooleanField` and `run_product_mapping:NullBooleanField`.

**approved: BooleanField​**

When this boolean field is true, the `ProductService._approve_pre_product()` method will be invoked during the update process to productize pre-products.

**run\_product\_mapping: NullBooleanField**[**​**](broken://pages/n1RuTBxyllethNor0GLO)

This boolean field is nullable. When it is true, the `ProductService._run_product_mapping()` method will be called during the update process to perform attribute mapping for products.

## Mapping​ <a href="#mapping" id="mapping"></a>

During the creation or update of pre-products, if `run_product_mapping` is set to True, they undergo a mapping process. The mapping process depends on the key values defined in `settings.PRODUCT_MAPPING_KEY_LIST` and the `language` value sent as kwargs during the update process or obtained from `translation.get_language() {django.utils.translation.get_language()}`.

Here's a pseudo example we can create for the mapping process:

```python
settings:
    PRODUCT_MAPPING_KEY_LIST=['size']
    LANGUAGE_CODE='tr-tr'
    LANGUAGES=[('tr-tr', 'Turkish'), ('en-us', 'English')]

script:
    attribute_old = Attribute(
        key=”size_erp”,
        is_localizable=True,
        pre_attribute=True)
    attribute_new = Attribute(
        key=”size”,
        is_localizable=True,
        pre_attribute=False)

    // Let's assume a pre-defined mapping.
    // Mapping(mapping_key=”size”,
    //      input_kwargs={“attributes__size_erp__isnull”: False})
    
    product.set_attribute(
            key=”size_erp”,
            value=”Large”,
            language=”en-us”)
    product.set_attribute(
            key=”size”,
            value=”Büyük”,
            language=”tr-tr”)
    ProductService._run_product_mapping(product, language=”tr-tr”)
```

The attribute key named `size_erp` of our product has been converted to the `size` key through mapping, and its value has been mapped from "Large" to "Büyük".

## Service​ <a href="#service" id="service"></a>

There is no separate service for pre-products; instead, all service operations are conducted through the `ProductService {omnitron.products.service.ProductService}`. The service structure will be detailed in the product documentation.

## <mark style="color:red;">ViewSet</mark>​ <a href="#viewset" id="viewset"></a>

The `PreProductViewSet {omnitron.products.resources.views.PreProductViewSet}` is extended from `ModelViewSet`, `MultiSerializerViewSetMixin`, and `FileFilterableViewSetMixin`, and it can be accessed via the `/api/v1/pre_products` endpoint.

Inherited from `ModelViewSet`, it allows `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` methods. The `perform_create()` and `perform_update()` functions are overridden to perform create/update operations on the relevant service, `ProductService`.

Inherited from `MultiSerializerViewSetMixin`, it includes the `detailed()` and `detailed_list()` functions but does not override them. Within the `serializer_action_classes`, `ProductDetailedSerializer` is defined for both `detailed` and `detailed_list`.

Inherited from `FileFilterableViewSetMixin`, it includes the `filter_queryset()`, `filter_import_queryset()`, and `initialize_request()` functions but does not override them. It holds the `file_filter_fieldname:List` list, which is used to intersect with the header fields of uploaded files in `FileFilterableViewSetMixin`.

### <mark style="color:red;">HTTP Methods​</mark> <a href="#http-methods" id="http-methods"></a>

### `GET` Get List of All Pre-Products​ <a href="#get-get-list-of-all-pre-products" id="get-get-list-of-all-pre-products"></a>

**Path:** `/api/v1/pre_products/`

This method retrieves the products that fulfil the condition `product_type__in=[ProductTypes.pre_product, ProductTypes.pre_miscellaneous]` from the Product table. It takes filter parameters found in ProductFilter `{omnitron.products.resources.filters.ProductFilter}` as query parameters and has a wide range of filtering options.

**Example Request​**

```
api/v1/pre_products/?is_active=True&attributes__renk=ANTRASIT
```

**Example Response​**

```json
HTTP200
[
    {
        "pk": 402,
        "name": "Banyo Halısı Desen 3 60x100+50x60cm",
        "base_code": "1KBAPA0195",
        "sku": "2672880315949",
        "product_type": "-1",
        "is_active": true,
        "parent": null,
        "attributes": {
            "erp_ProductAtt06Desc": "(60X100)+(50X60)",
            "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
            "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
            "uretim_yeri": "ÇİN",
            "renk": "ANTRASİT",
            "integration_ProductAtt03Desc": "2011/2012 KIŞ",
            "erp_ProductAtt07Desc": "50+50 promosyon",
            "erp_color": "ANTRASİT",
            "materyal": "%100 POLYESTER",
            "integration_ProductAtt22Desc": "5,50 x 9,00 cm",
            "integration_ProductAtt14Desc": "60X100+50X60 CM MAKİNE KESMESİ",
            "erp_ProductHierarchyLevel01": "TEKSTİL",
            "erp_ProductAtt13Desc": "YER GRUBU %50+%50",
            "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
            "erp_ProductAtt09Desc": "Flannel Baby Touch Machine",
            "erp_ProductAtt02Desc": "Yer Grubu - Paspas",
            "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
            "erp_ProductAtt20Desc": "%100 POLYESTER",
            "filtre_renk1": "Gri",
            "erp_ProductAtt22Desc": "5,50 x 9,00 cm",
            "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
            "erp_ProductCode": "1KBAPA0195244",
            "integration_ProductAtt13Desc": "YER GRUBU %50+%50",
            "integration_ProductAtt01Desc": "DIŞ ALIM",
            "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
            "boyut": "(60X100)+(50X60)",
            "erp_ProductAtt14Desc": "60X100+50X60 CM MAKİNE KESMESİ",
            "erp_ProductAtt01Desc": "DIŞ ALIM",
            "erp_ProductHierarchyLevel02": "Yer Grubu",
            "integration_ProductCode": "1KBAPA0195244",
            "integration_ProductAtt07Desc": "50+50 promosyon",
            "erp_ProductAtt03Desc": "2011/2012 KIŞ",
            "integration_ProductAtt09Desc": "Flannel Baby Touch Machine",
            "integration_ProductHierarchyLevel01": "TEKSTİL",
            "integration_ProductHierarchyLevel02": "Yer Grubu",
            "erp_ProductAtt25Desc": "ÇİN",
            "integration_ProductAtt02Desc": "Yer Grubu - Paspas"
        },
        "attributes_kwargs": {
            "erp_ProductHierarchyLevel01": {
                "value": "TEKSTİL",
                "data_type": "dropdown",
                "label": "TEKSTİL"
            },
            "erp_ProductHierarchyLevel02": {
                "value": "Yer Grubu",
                "data_type": "dropdown",
                "label": "Yer Grubu"
            },
            "filtre_renk1": {
                "value": "Gri",
                "data_type": "dropdown",
                "label": "Gri"
            },
            "erp_color": {
                "value": "ANTRASİT",
                "data_type": "dropdown",
                "label": "ANTRASİT"
            },
            "integration_ProductHierarchyLevel01": {
                "value": "TEKSTİL",
                "data_type": "dropdown",
                "label": "TEKSTİL"
            },
            "integration_ProductHierarchyLevel02": {
                "value": "Yer Grubu",
                "data_type": "dropdown",
                "label": "Yer Grubu"
            },
            "renk": {
                "value": "ANTRASİT",
                "data_type": "dropdown",
                "label": "ANTRASİT"
            }
        },
        "extra_attributes": {},
        "group_products": [],
        "productimage_set": [{
                "pk": 592,
                "status": "active",
                "image": "http://.../media/products/2017/01/23/402/1ece7020bcc8.jpg",
                "order": 0,
                "created_date": "2017-01-23T08:34:48.487333Z",
                "specialimage_set": [],
                "modified_date": "2017-01-23T08:34:48.487367Z"
            },
            {
                "pk": 593,
                "status": "active",
                "image": "http://.../media/products/2017/01/23/402/4375a49a5e2a.jpg",
                "order": 1,
                "created_date": "2017-01-23T08:34:48.590416Z",
                "specialimage_set": [],
                "modified_date": "2017-01-23T08:34:48.590456Z"
            }
        ],
        "attribute_set": 16,
        "custom_attribute_set": null,
        "productization_date": null,
        "listing_code": null,
        "data_source": null,
        "modified_date": "2017-02-02T11:15:40.058780Z"
    },
    {...},
    {...}
]
```

***

### `POST` Create a Single Pre-Product​ <a href="#post-create-a-single-pre-product" id="post-create-a-single-pre-product"></a>

**Path:** `/api/v1/pre_products/`

This method records new objects to the Products table. It's validated with `PreProductSerializer`; if the data is not appropriate or the `product_type` value is neither `ProductTypes.pre_product` nor `ProductTypes.pre_miscellaneous`, an HTTP 404 error is returned. The flawless data is sent to the `ProductService.create_product()` method for processing, and the service executes the recording operation.

**Example Request​**

```json
{
    "product_type": "string", // "-1" (pre_product), "5" (miscellaneous)
    "sku": "string",
    "attributes_kwargs": "string",
    "data_source": "string",
    "product_type": "string",
    "name": "string",
    "parent": "string",
    "listing_code": "string",
    "is_child_update": "string",
    "is_active": "string",
    "extra_attributes": "string",
    "productization_date": "string",
    "custom_attribute_set": "string",
    "run_product_mapping": "string",
    "attribute_set": "string",
    "group_products": "string",
    "update_product_meta_name": "string",
    "base_code": "string",
    "attributes": "string",
    "approved": "string"
}
```

**Example Response​**

```
HTTP200
```

***

### `DELETE` Delete a Single Pre-Product​ <a href="#delete-delete-a-single-pre-product" id="delete-delete-a-single-pre-product"></a>

**Path:** `/api/v1/pre_products/{pk}/`

This method deletes the object from the Products table corresponding to the relevant primary key. An HTTP 404 error is returned if the object cannot be found.

**Example Request​**

```
/api/v1/pre_products/402/
```

**Example Response​**

```
HTTP200
```

***

### `GET` Get a Single Pre-Product​ <a href="#get-get-a-single-pre-product" id="get-get-a-single-pre-product"></a>

**Path:** `/api/v1/pre_products/{pk}/`

This method retrieves the object from the Products table corresponding to the relevant primary key. An HTTP 404 error is returned if the object cannot be found.

**Example Request​**

```
/api/v1/pre_products/402/
```

**Example Response​**

```
HTTP200
{
    "pk": 415,
    "name": "Banyo Halısı Desen 2 50x80+45x50cm",
    "base_code": "1KBAPA0197",
    "sku": "2672880316076",
    "product_type": "-1",
    "is_active": true,
    "parent": null,
    "attributes": {
        "erp_ProductAtt06Desc": "(50X80)+(45X50) CM",
        "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
        "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
        "uretim_yeri": "ÇİN",
        "renk": "TOPRAK",
        "integration_ProductAtt03Desc": "2011/2012 KIŞ",
        "erp_ProductAtt07Desc": "50+50 promosyon",
        "erp_color": "TOPRAK",
        "materyal": "%100 POLYESTER",
        "integration_ProductAtt22Desc": "5,50 x 9,00 cm",
        "integration_ProductAtt14Desc": "50X80+45X50 CM MAKİNE KESMESİ",
        "erp_ProductHierarchyLevel01": "TEKSTİL",
        "erp_ProductAtt13Desc": "YER GRUBU %50+%50",
        "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
        "erp_ProductAtt09Desc": "Flannel Baby Touch Machine",
        "erp_ProductAtt02Desc": "Yer Grubu - Paspas",
        "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
        "erp_ProductAtt20Desc": "%100 POLYESTER",
        "filtre_renk1": "Toprak",
        "erp_ProductAtt22Desc": "5,50 x 9,00 cm",
        "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
        "erp_ProductCode": "1KBAPA0197102",
        "integration_ProductAtt13Desc": "YER GRUBU %50+%50",
        "integration_ProductAtt01Desc": "DIŞ ALIM",
        "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
        "boyut": "(50X80)+(45X50) CM",
        "erp_ProductAtt14Desc": "50X80+45X50 CM MAKİNE KESMESİ",
        "erp_ProductAtt01Desc": "DIŞ ALIM",
        "erp_ProductHierarchyLevel02": "Yer Grubu",
        "integration_ProductCode": "1KBAPA0197102",
        "integration_ProductAtt07Desc": "50+50 promosyon",
        "erp_ProductAtt03Desc": "2011/2012 KIŞ",
        "integration_ProductAtt09Desc": "Flannel Baby Touch Machine",
        "integration_ProductHierarchyLevel01": "TEKSTİL",
        "integration_ProductHierarchyLevel02": "Yer Grubu",
        "erp_ProductAtt25Desc": "ÇİN",
        "integration_ProductAtt02Desc": "Yer Grubu - Paspas"
    },
    "attributes_kwargs": {
        "erp_ProductHierarchyLevel01": {
            "value": "TEKSTİL",
            "data_type": "dropdown",
            "label": "TEKSTİL"
        },
        "erp_ProductHierarchyLevel02": {
            "value": "Yer Grubu",
            "data_type": "dropdown",
            "label": "Yer Grubu"
        },
        "filtre_renk1": {
            "value": "Toprak",
            "data_type": "dropdown",
            "label": "Toprak"
        },
        "erp_color": {
            "value": "TOPRAK",
            "data_type": "dropdown",
            "label": "TOPRAK"
        },
        "integration_ProductHierarchyLevel01": {
            "value": "TEKSTİL",
            "data_type": "dropdown",
            "label": "TEKSTİL"
        },
        "integration_ProductHierarchyLevel02": {
            "value": "Yer Grubu",
            "data_type": "dropdown",
            "label": "Yer Grubu"
        },
        "renk": {
            "value": "TOPRAK",
            "data_type": "dropdown",
            "label": "TOPRAK"
        }
    },
    "extra_attributes": {},
    "group_products": [],
    "productimage_set": [{
            "pk": 608,
            "status": "active",
            "image": "http://.../media/products/2017/01/23/aa578d275807.jpg",
            "order": 0,
            "created_date": "2017-01-23T08:34:50.032604Z",
            "specialimage_set": [],
            "modified_date": "2017-01-23T08:34:50.032631Z"
        },
        {
            "pk": 609,
            "status": "active",
            "image": "http://.../media/products/2017/01/23/415/69e29c79caf2.jpg",
            "order": 1,
            "created_date": "2017-01-23T08:34:50.132254Z",
            "specialimage_set": [],
            "modified_date": "2017-01-23T08:34:50.132280Z"
        }
    ],
    "attribute_set": 13,
    "custom_attribute_set": null,
    "productization_date": null,
    "listing_code": null,
    "data_source": null,
    "modified_date": "2017-02-02T11:15:41.020549Z"
}
```

***

### `PATCH` Update a Single Pre-Product​ <a href="#patch-update-a-single-pre-product" id="patch-update-a-single-pre-product"></a>

**Path:** `/api/v1/pre_products/{pk}/`

This method partially updates the object from the Products table corresponding to the relevant primary key. It's validated with `PreProductSerializer`; if the data is not appropriate or the `product_type` value is neither `ProductTypes.pre_product` nor `ProductTypes.pre_miscellaneous`, an HTTP 404 error is returned. An HTTP 404 error is returned if the object cannot be found. The partial update method updates only the parameters sent as data.

***

### `PUT` Update a Single Pre-Product​ <a href="#put-update-a-single-pre-product" id="put-update-a-single-pre-product"></a>

**Path:** `/api/v1/pre_products/{pk}/`

This method updates the object from the Products table corresponding to the relevant primary key. It's validated with `PreProductSerializer`; if the data is not appropriate or the `product_type` value is neither `ProductTypes.pre_product` nor `ProductTypes.pre_miscellaneous`, an HTTP 404 error is returned. An HTTP 404 error is returned if the object cannot be found. The update method updates the entire object. The flawless data is sent to the `ProductService.update_product()` method for processing, and the service executes the update operation.

***

### `POST` Bulk Create Pre-Products​ <a href="#post-bulk-create-pre-products" id="post-bulk-create-pre-products"></a>

**Path:** `/api/v1/pre_products/bulk_create/`

This method asynchronously creates new objects in the Products table in bulk with an uploaded CSV or Excel file. Each creation process is delayed as a separate task. Since each task handles its own serialization, if there's an error, only the task that encountered the error will fail.

This method accepts formdata as a request and includes the path of the CSV or Excel file as `filename`. As a response, it returns the `cache_key` parameter stored in Redis for async tasks. In the creation process, the `sku` parameter is mandatory and must be present in the file.

**Example Request​**

```
/api/v1/pre_products/bulk_create/
-F 'filename=@/path/create.csv'
```

**Example Response​**

```json
HTTP200
{
"cache_key": "5c6ba584-156a-42d6-8b86-ca9c7d1a36c6"
}
```

***

### `GET` Bulk Create Cache Key Status​ <a href="#get-bulk-create-cache-key-status" id="get-bulk-create-cache-key-status"></a>

**Path:** `/api/v1/pre_products/{cache_key}/bulk_create_status/`

This method queries the status of an executed bulk create operation.

**Example Request​**

```
/api/v1/pre_products/5c6ba584-156a-42d6-8b86-ca9c7d1a36c6/bulk_create_status/
```

**Example Response​**

```
HTTP200
{
    "progress": [
        11,
        11
    ],
    "completed": true,
    "errors": [],
    "chunk_count": 11
}
```

***

### `POST` Bulk Update Pre-Products​ <a href="#post-bulk-update-pre-products" id="post-bulk-update-pre-products"></a>

**Path:** `/api/v1/pre_products/bulk_update/`

This method asynchronously updates objects in the Products table in bulk with an uploaded CSV or Excel file. Each update process is delayed as a separate task. Since each task handles its own serialization, if there's an error, only the task that encountered the error will fail.

This method accepts formdata as a request, and the path of the CSV or Excel file is sent within the `filename` parameter. As a response, it returns the `cache_key` parameter stored in Redis for async tasks. The update operation is performed similar to partial update based on the "sku" parameter in the file, updating only the parameters sent as data.

**Example Request​**

```
/api/v1/pre_products/bulk_update/
-F 'filename=@/path/update.csv'
```

**Example Response​**

```json
HTTP200
{
"cache_key": "5c6ba584-156a-42d6-8b86-ca9c7d1a36c6"
}
```

***

### `GET` Bulk Update Cache Key Status​ <a href="#get-bulk-update-cache-key-status" id="get-bulk-update-cache-key-status"></a>

**Path:** `/api/v1/pre_products/{cache_key}/bulk_update_status/`

This method queries the status of an executed bulk update operation.

**Example Request​**

```
/api/v1/pre_products/5c6ba584-156a-42d6-8b86-ca9c7d1a36c6/bulk_update_status/
```

**Example Response​**

```json
HTTP200
{
    "progress": [
        11,
        11
    ],
    "completed": true,
    "errors": [],
    "chunk_count": 11
}
```

***

### `GET` Get List of All Pre-Products - Detailed​ <a href="#get-get-list-of-all-pre-products---detailed" id="get-get-list-of-all-pre-products---detailed"></a>

**Path:** `/api/v1/pre_products/detailed/`

This method retrieves products from the Product table that fulfil the condition `product_type__in=[ProductTypes.pre_product, ProductTypes.pre_miscellaneous]`. It uses `ProductDetailedSerializer` instead of `PreProductSerializer`, and in this ViewSet, it's specified as `detailed_list` within the `serializer_action_classes` inherited from `MultiSerializerViewSetMixin`.

It takes filter parameters found in ProductFilter `{omnitron.products.resources.filters.ProductFilter}` as query parameters and has a wide range of filtering options.

***

### `GET` Get a Single Pre-Product - Detailed​ <a href="#get-get-a-single-pre-product---detailed" id="get-get-a-single-pre-product---detailed"></a>

**Path:** `/api/v1/pre_products/{pk}/detailed/`

This method retrieves the object from the Product table corresponding to the relevant primary key. An HTTP 404 error is returned if the object cannot be found. It uses `ProductDetailedSerializer` instead of `PreProductSerializer`, and in this ViewSet, it's specified as detailed within the `serializer_action_classes` inherited from `MultiSerializerViewSetMixin`.

***


# Attribute

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product attributes. By leveraging these methods, users can retrieve, create, update, and search product attributes, allowing for seamless integration and management of product data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product attribute API.

## <mark style="color:red;">Get Attributes</mark>

Attributes are features of the products. For example, a t-shirt has color, size, fabric, etc. as attributes; however, a mobile phone has camera resolution, screen brightness, memory and disk capacity, color etc. attributes.

You can query the attributes to get a list of defined attributes.

<table data-header-hidden><thead><tr><th width="131.1328125"></th><th width="120.77734375"></th><th width="105.77734375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td><code>api_token</code></td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td><code>limit</code></td><td>integer</td><td>query</td><td>Amount of line items per page that will be returned</td></tr><tr><td><code>page</code></td><td>integer</td><td>query</td><td>Page number to return</td></tr></tbody></table>

#### <mark style="color:red;">**Request GET**</mark>

GET request is used for retrieving attributes. Check Search-Attribute section for filtering options.

`content_type` header represents the response type.

`Authorization` header is a required header for authentication. You can retrieve api\_token with login.

`Accept-language` header determines translatable fields responses.

**Path**: `i1/attributes/`

```python

import requests
url = "https://{customer_api_url}/api/i1/attributes/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-language':'en-us'
}

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

```

**Response**

Resource properties are in Python format. The table below shows attribute properties. Every field has been explained in the description section of the table.

<table data-header-hidden><thead><tr><th width="140.890625"></th><th width="141.671875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Description</strong></td></tr><tr><td>key</td><td>string</td><td>Attribute’s code</td></tr><tr><td>data_type</td><td>enum</td><td>Type of data the corresponding attribute contains. It could be text, email, text_area, date, datetime, boolean, valuelabel, dropdown, multiple, price, nested_object, image, file, model, bundle</td></tr><tr><td>value</td><td>string</td><td>Attribute's value</td></tr><tr><td>label</td><td>string</td><td>Attribute's label. It is used on the frontend</td></tr><tr><td>default_value</td><td>string</td><td>Default value of the attribute</td></tr><tr><td>is_required</td><td>boolean</td><td>Defines whether or not to leave this attribute blank when creating or updating the product</td></tr><tr><td>is_visible</td><td>boolean</td><td>Defines whether this attribute will appear on the backoffice panel</td></tr><tr><td>is_searchable</td><td>boolean</td><td>Defines whether search can be made with this attribute</td></tr><tr><td>is_filterable</td><td>boolean</td><td>Defines whether the value of this attribute can be filtered</td></tr><tr><td>is_variant</td><td>boolean</td><td>Defines whether this attribute is variantable or not. For example, if this parameter is <em>True</em> for the "size" attribute, there will be a variant based on this value among child products linked to the parent product: X size t-shirt, L size t-shirt etc.</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>Defines whether different variants of the same product will appear on the product listing page</td></tr><tr><td>name</td><td>string</td><td>Attribute name</td></tr><tr><td>is_form_required</td><td>boolean</td><td>Customer must fill in a form when adding a product with "is form required == True" to the cart</td></tr><tr><td>is_form_field_required</td><td>boolean</td><td>Defines whether the form field is required to fill</td></tr><tr><td>erp_code</td><td>string</td><td>The code of this attribute code in ERP</td></tr><tr><td>pre_attribute</td><td>boolean</td><td>Defines whether the attribute is used for pre products or products</td></tr></tbody></table>

“count” shows how many attributes exist in the system.

“next” shows the next cursor url to retrieve the desired attributes.

“previous” shows the previous cursor url to retrieve the desired attribute.

“results” shows every attribute detail with detailed field descriptions.

```
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
     {
       "id": 1457,
       "key": "test_size_attribute2",
       "data_type": {
           "value": "dropdown",
           "label": "dropdown",
       },
       "default_value": null,
       "is_required": false,
       "is_visible": false,
       "is_searchable": false,
       "is_filterable": false,
       "is_variant": false,
       "is_variant_listable": false,
       "name": "test_size_attribute EN",
       "is_form_required": false,
       "is_form_field_required": false,
       "erp_code": "erp_test_size_attribute_2",
       "pre_attribute": false,
    }
  ]
}
```

**Request GET Instance**

Retrieves an attribute with a unique identifier.

`content_type` header represents the response type.

`Authorization` header required header for authentication. You can retrieve api\_token with login.

`Accept-language` header determines translatable fields responses.

Path: i1/attributes/\<pk>/

```python

import requests
url = "https://{customer_api_url}/api/i1/attributes/1457/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-language':'en-us'
}

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

```

**Response**

Shows the details of the attribute with a given unique identifier.

```json
{
   "id": 1457,
   "key": "test_size_attribute2",
   "data_type": dropdown,
   "default_value": null,
   "is_required": false,
   "is_visible": false,
   "is_searchable": false,
   "is_filterable": false,
   "is_variant": false,
   "is_variant_listable": false,
   "name": "test_size_attribute EN",
   "is_form_required": false,
   "is_form_field_required": false,
   "erp_code": "erp_test_size_attribute_2",
   "pre_attribute": false,
}
```

## <mark style="color:red;">Search Attribute</mark>

GET requests can be filtered with parameters. You can search "attribute" according to these labels. All the below labels are acceptable as query parameters. For example, if you are looking for only required attributes, you need to send **‘?is\_required=True’** at the end of the url.

<table data-header-hidden><thead><tr><th width="139.02734375"></th><th width="123.3046875"></th><th width="115.95703125"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td><code>api_token</code></td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td><code>limit</code></td><td>integer</td><td>query</td><td>Amount of line items per page that will be returned</td></tr><tr><td><code>page</code></td><td>integer</td><td>query</td><td>Page number to return</td></tr><tr><td>name</td><td>string</td><td>params</td><td>Attribute name</td></tr><tr><td>key</td><td>string</td><td>params</td><td>Attribute code</td></tr><tr><td>is_variant</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>is_searchable</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>is_visible</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>is_required</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>data_type</td><td>boolean</td><td>params</td><td>text, text_area, dropdown</td></tr><tr><td>is_localizable</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>params</td><td>True / False</td></tr><tr><td>modified_date__gt</td><td>datetime</td><td>params</td><td>Last updated date greater than</td></tr><tr><td>modified_date__lt</td><td>datetime</td><td>params</td><td>Last updated date lower than</td></tr><tr><td>modified_date__gte</td><td>datetime</td><td>params</td><td>Last updated date greater and equal than</td></tr><tr><td>modified_date__lte</td><td>datetime</td><td>params</td><td>Last updated date lower and equal than</td></tr><tr><td>modified_date__date__gt</td><td>date</td><td>params</td><td>Last updated date greater than</td></tr><tr><td>modified_date__date__lt</td><td>date</td><td>params</td><td>Last updated date lower than</td></tr><tr><td>modified_date__date__gte</td><td>date</td><td>params</td><td>Last updated date greater and equal than</td></tr><tr><td>modified_date__date__lte</td><td>date</td><td>params</td><td>Last updated date lower and equal than</td></tr><tr><td>accept-language</td><td>string</td><td>params</td><td>Language code (Ex: "en-us","tr-tr")</td></tr></tbody></table>

#### <mark style="color:red;">**Request GET**</mark>

Retrieves attributes with filtered desired values. Below example shows filtering attributes with ‘attribute\_name’.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘Accept-language’ header determines translatable fields responses.

Path: attributes/

```python

import requests

url = "https://{customer_api_url}/api/i1/attributes/?<attribute_name>=<attribute_value>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-language':'en-us'
}
params = {
    'key':'test_text_attribute',
    'limit':'4',
    'page':'1'
}

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

```

**Response**

Response contains all attribute data with search parameters and with pagination. Response status is expected to be HTTP-200 Successful.

The table below shows attribute properties. Every field has been explained in the description section of the table.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="145.7578125"></th><th width="108.734375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Description</strong></td></tr><tr><td>ID</td><td>integer</td><td>Attribute identifier number</td></tr><tr><td>key</td><td>string</td><td>Attribute code</td></tr><tr><td>data_type</td><td>enum</td><td>Specifies the data type of the property. It can take the following values: text, text_area, dropdown</td></tr><tr><td>value</td><td>string</td><td>Attribute's value</td></tr><tr><td>label</td><td>string</td><td>Attribute's label. It is used on the frontend</td></tr><tr><td>default_value</td><td>string</td><td>Default value of the attribute</td></tr><tr><td>is_required</td><td>boolean</td><td>Defines whether or not to leave this attribute blank when creating or updating the product</td></tr><tr><td>is_visible</td><td>boolean</td><td>Defines whether this attribute will appear on the back office panel</td></tr><tr><td>is_searchable</td><td>boolean</td><td>Defines whether search can be made with this attribute</td></tr><tr><td>is_filterable</td><td>boolean</td><td>Defines whether the value of this attribute can be filtered</td></tr><tr><td>is_variant</td><td>boolean</td><td>Defines whether this attribute is variantable or not. For example, if this parameter is <em>True</em> for the "size" attribute, there will be a variant based on this value among child products linked to the parent product: X size t-shirt, L size t-shirt etc.</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>Defines whether different variants of the same product will appear on the product listing page</td></tr><tr><td>name</td><td>string</td><td>Attribute name</td></tr><tr><td>is_form_required</td><td>boolean</td><td>Customer must fill in a form when adding a product with "is form required == True" to the cart</td></tr><tr><td>is_form_field_required</td><td>boolean</td><td>Defines whether the form field is required to fill</td></tr><tr><td>erp_code</td><td>string</td><td>The code of this attribute code in ERP</td></tr></tbody></table>

“count” shows how many attributes exist in the system.

“next” shows the next page url to retrieve the desired attribute.

“previous” shows the previous page url to retrieve the desired attribute.

“results” shows every attribute property with detailed field descriptions.

```json

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1458,
      "key": "test_text_attribute",
      "data_type": {
        "value": "text",
        "label": "Text"
      },
      "default_value": null,
      "is_required": false,
      "is_visible": false,
      "is_searchable": false,
      "is_filterable": false,
      "is_variant": false,
      "is_variant_listable": false,
      "name": "Dummy Size",
      "is_form_required": false,
      "is_form_field_required": false,
      "erp_code": "erp_test_text_attribute",
      "pre_attribute": false
    }
  ]
}

```

## <mark style="color:red;">Create Attribute</mark>

Attributes are features of the products. For example, a t-shirt has color, size, fabric, etc. as attributes; however, a mobile phone has camera resolution, screen brightness, memory and disk capacity, color etc. attributes.

You can query the attributes to get a list of defined attributes.

<table data-header-hidden><thead><tr><th width="113.65625"></th><th width="105.5859375"></th><th width="88.16015625"></th><th width="97.8671875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>YES</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>default_value</td><td>string</td><td>body</td><td></td><td>The default value for the attribute. For example the default value for the size attribute is M.</td></tr><tr><td>is_visible</td><td>boolean</td><td>body</td><td></td><td>(default <em>True</em>) Determines whether the attribute will appear on the website. <em>"_False</em> could be selected for attributes that will be used during the back office (Omnitron) and not used on the website. For example, ERP color code, ERP SKU, etc.</td></tr><tr><td>data_type</td><td>string</td><td>body</td><td>YES</td><td>Specifies the data type of the property. It can take the following values: text, text_area, dropdown</td></tr><tr><td>translations</td><td>list</td><td>body</td><td></td><td>If the attribute has different language support, the names of the attribute used in different languages are listed under **translations**. Such as, "en-us": "name": "SIZE"</td></tr><tr><td>description</td><td>string</td><td>body</td><td></td><td>Description of the attribute</td></tr><tr><td>is_form_required</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) The customer needs to fill out a form when adding a product whose <strong>is_form_required</strong> value is <em>True</em> to the cart. Such as the name and note to be written on the jewelry, watches, wallets, flowers.</td></tr><tr><td>is_form_field_required</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) Defines whether the fields in the form (associated with "is_form_required") shown to the customer are required.</td></tr><tr><td>is_filterable</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) If the parameter is <em>True</em>, this attribute can be viewed in filters.</td></tr><tr><td>is_searchable</td><td>boolean</td><td>body</td><td></td><td>(default <em>True</em>) If the parameter is <em>True</em>, the customer can search with the value of the attribute on the website.</td></tr><tr><td>pre_attribute</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) The <strong>pre_attribute</strong> value <em>True</em> should be defined if the attributes integrated from the ERP are requested to be reviewed and approved before they are put into use.</td></tr><tr><td>is_localizable</td><td>boolean</td><td>body</td><td></td><td>(default False) If the value of the attribute will be used in different languages, True must be entered. For example, if this value is True, the description attribute can be used like EN: This rug is made of polyester from recycled PET bottles, and NL: Dit vloerkleed is gemaakt van polyester van gerecyclede PET-flessen.</td></tr><tr><td>key</td><td>string</td><td>body</td><td>YES</td><td>Unique attribute code</td></tr><tr><td>erp_code</td><td>string</td><td>body</td><td>YES</td><td>The attribute code included on ERP</td></tr><tr><td>is_variant</td><td>boolean</td><td>body</td><td></td><td>(default 'False') Defines whether the product can be variant or not via the attribute. For example, if is_variant is 'True'for the size attribute, it is possible to make variants such as X size sweater, L size sweater among child products connected to the same parent product.</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) Determines whether different variants of the same product will appear on the product listing page.</td></tr><tr><td>is_required</td><td>boolean</td><td>body</td><td></td><td>(default <em>False</em>) Defines whether the attribute is required. It determines whether the attribute value can be left blank when creating or updating the product.</td></tr><tr><td>name</td><td>string</td><td>body</td><td>YES</td><td>Attribute name</td></tr></tbody></table>

#### <mark style="color:red;">**Request POST**</mark>

In this example, the attribute will be created with a dropdown type and in Turkish ("tr-tr") which is Omnitron's default language.

**Path**: v1/attributes/

```python

import requests
import json

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

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

data = {
    "key": "test_size_attribute2",
    "data_type": "dropdown",
    "default_value": None,
    "is_required": False,
    "is_visible": False,
    "is_searchable": False,
    "is_filterable": False,
    "is_variant": False,
    "is_variant_listable": False,
    "name": "test_size_attribute",
    "is_form_required": False,
    "is_form_field_required": False,
    "erp_code": "erp_test_size_attribute_2",
    "pre_attribute": False,
    "description": None
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Shows the details of the attribute that was created.

```json

{
  "pk": 1457,
  "key": "test_size_attribute2",
  "data_type": "dropdown",
  "default_value": null,
  "is_required": false,
  "is_visible": false,
  "is_searchable": false,
  "is_filterable": false,
  "is_variant": false,
  "is_variant_listable": false,
  "name": "test_size_attribute",
  "is_form_required": false,
  "is_form_field_required": false,
  "erp_code": "erp_test_size_attribute_2",
  "pre_attribute": false,
  "description": null,
  "is_localizable": false
}

```

### <mark style="color:red;">**Language Support**</mark>

**Note:** If Attribute type is ‘text’ or ‘text\_area’ and the attribute will be used in different languages, **is\_localizable** parameter should be *True*. In order to send language translation for an attribute, the **Accept-Language** parameter needs to be added to the header. Accept-Language parameter is an optional parameter. If it is not sent, Omnitron's default language will be defined.

#### <mark style="color:red;">**Request POST**</mark>

In this example, the attribute will be created with text type and in Turkish ("tr-tr") which is Omnitron's default language.

**Path:** v1/attributes/

```python

import requests
import json

url = "https://{customer_api_url}/api/v1/products/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
    "key": "test_text_attribute",
    "data_type": "text",
    "default_value": None,
    "is_localizable": True,
    "is_required": False,
    "is_visible": False,
    "is_searchable": False,
    "is_filterable": False,
    "is_variant": False,
    "is_variant_listable": False,
    "name": "Dummy Size",
    "is_form_required": False,
    "is_form_field_required": False,
    "erp_code": "erp_test_text_attribute",
    "pre_attribute": False,
    "description": None
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns the created attribute data. Response status is expected to be HTTP-201 Created. “modified\_date” and “created\_date” parameters show the date when the attribute was last modified, and the date when it was created.

```json

{
  "pk": 1458,
  "key": "test_text_attribute",
  "data_type": "text",
  "default_value": null,
  "is_required": false,
  "is_visible": false,
  "is_searchable": false,
  "is_filterable": false,
  "is_variant": false,
  "is_variant_listable": false,
  "name": "Dummy Size",
  "is_form_required": false,
  "is_form_field_required": false,
  "erp_code": "erp_test_text_attribute",
  "pre_attribute": false,
  "description": null,
  "is_localizable": true
  "modified_date": "2016-12-14T14:56:02.160001Z",
  "created_date": "2016-12-14T14:56:02.160001Z",
}

```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

“is\_localizable” property can be *True* only if ‘data\_type’ of an attribute is ‘text’ or ‘text\_area’.

```json

{
  "non_field_errors": [
    "is_localizable field cannot be True when Attribute data_type is not one of text or text area"]
}

```

“erp\_code” is a unique field and doesn’t accept duplicate data.

```json

{
  "non_field_errors": "(erp_code:erp_color) is already exists",
  "error_code": "attribute_200_1"
}
```

There are some reserved keys which cannot be used to create attributes. Reserved keys are Product model fields excluding description, brand, weight and tax\_rate. Check the **Product** section to see the entire reserved key list.

```json

{
  "non_field_errors": "Requested key name cannot be used. modified_date is reserved.",
  "error_code": "attribute_200_6"
}

```

## <mark style="color:red;">Update Attribute</mark>

To update an attribute, it is necessary to know its ID. For example, you change the ‘is\_visible’ parameter from *False* to *True*. There are some restrictions with which you cannot perform an update. How to get ID and other details are explained under [Search Attribute](broken://pages/8OwYVW5M1me0cE2Rp17U) section.

<table data-header-hidden><thead><tr><th width="157.58984375">Parameter</th><th width="105.82421875">Data Type</th><th width="91.60546875">In</th><th>Description</th></tr></thead><tbody><tr><td></td><td></td><td></td><td></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>default_value</td><td>string</td><td>body</td><td>The default value for the attribute. For example, the default value for the size attribute is M.</td></tr><tr><td>is_visible</td><td>boolean</td><td>body</td><td>(default 'True') Determines whether the feature will appear on the website. 'False' could be selected for attributes that will be used at the back office (Omnitron) and not used on the website. For example, ERP color code, ERP SKU, etc.</td></tr><tr><td>data_type</td><td>string</td><td>body</td><td>Specifies the data type of the property. It can take the following values: text, text_area, dropdown</td></tr><tr><td>translations</td><td>list</td><td>body</td><td>If the attribute has different language support, the names of the attribute used in different languages are listed under translations. For example, `"en-us": "name": "SIZE"` .</td></tr><tr><td>description</td><td>sting</td><td>body</td><td>Description of attribute</td></tr><tr><td>is_form_required</td><td>boolean</td><td>body</td><td>(default 'False') The customer needs to fill out a form when adding a product whose is_form_required value is 'True' to the cart. Such as the name and note to be written on the jewelry, watches, wallets, flowers.</td></tr><tr><td>is_form_field_required</td><td>boolean</td><td>body</td><td>(default 'False') Defines whether the fields in the form (associated with "is_form_required") shown to the customer are required.</td></tr><tr><td>is_filterable</td><td>boolean</td><td>body</td><td>(default 'False') If the parameter is 'True', this attribute can be viewed in filters</td></tr><tr><td>is_searchable</td><td>boolean</td><td>body</td><td>(default 'True') If the parameter is 'True', the customer can search with the value of the attribute on the website</td></tr><tr><td>pre_attribute</td><td>boolean</td><td>body</td><td>(default 'False') The pre_attribute value 'True' should be defined if the attributes integrated from the ERP are requested to be reviewed and approved before they are put into use</td></tr><tr><td>is_localizable</td><td>boolean</td><td>body</td><td>(default 'False') If the value of the attribute will be used in different languages, 'True' must be entered. For example, if this value is 'True', the description attribute can be used as EN: This rug is made of polyester from recycled PET bottles,<br>and NL: Dit vloerkleed is gemaakt van polyester van gerecyclede PET-flessen.</td></tr><tr><td>key</td><td>sting</td><td>body</td><td>Unique attribute code</td></tr><tr><td>erp_code</td><td>string</td><td>body</td><td>The attribute code included on ERP</td></tr><tr><td>is_variant</td><td>boolean</td><td>body</td><td>(default 'False') Defines whether the product can be variant or not via the attribute. For example, if is_variant is 'True' for the size attribute, it is possible to make variants such as X size sweater, L size sweater among child products connected to the same parent product.</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>body</td><td>(default 'False') Determines whether different variants of the same product will appear on the product listing page</td></tr><tr><td>is_required</td><td>boolean</td><td>body</td><td>(default 'False') Defines whether the attribute is required. It determines whether the attribute value can be left blank when creating or updating the product.</td></tr><tr><td>name</td><td>string</td><td>body</td><td>Attribute name</td></tr><tr><td>is_localizable</td><td>boolean</td><td>body</td><td>(default 'False') Defines whether the attribute is translatable or not. Only ‘text’ or ‘text_area’ type of attributes can be localizable</td></tr></tbody></table>

#### <mark style="color:red;">**Request PATCH**</mark>

There are three sections of an update request. Url with instance ID, headers and data which can change the desired field(s) of an attribute.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

**Path:** v1/attributes/\<ATTRIBUTE\_ID>

```python

import requests
import json

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


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

cookies = {
    'django_language':'en-us'
}

data = {
    "key": "test_size_attribute2",
    "data_type": "dropdown",
    "name": "test_size_attribute EN"
}

response = requests.patch(url, headers=headers, cookies=cookies , data=json.dumps(data))
print(response.text)

```

**Response**

After the update is done, the response shows the updated data of the attribute.

‘created\_date’ shows the date when the attribute was created.

‘modified\_date’ shows the date of the last attribute update.

```json

{
  "pk": 1457,
  "key": "test_size_attribute2",
  "data_type": "dropdown",
  "default_value": null,
  "is_required": false,
  "is_visible": false,
  "is_searchable": false,
  "is_filterable": false,
  "is_variant": false,
  "is_variant_listable": false,
  "name": "test_size_attribute EN",
  "is_form_required": false,
  "is_form_field_required": false,
  "erp_code": "erp_test_size_attribute_2",
  "pre_attribute": false,
  "description": null,
  "modified_date": "2022-02-21T08:13:40.424413Z",
  "created_date": "2016-12-14T14:56:02.160001Z,
  "is_localizable: false
}

```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

```json

{
  "non_field_errors": "Data type can not be updated",
  "error_code": "attribute_200_5"
}

```

If the ‘is\_localizable’ field is *True*, any Product has the attribute. ‘Is\_lozalizable’ field cannot be updated to *False*.

```json

{
  "non_field_errors": "Attribute is used by Product(s). Can not update is_localizable field!",
  "error_code": "attribute_200_4"
}

```

If an attribute is used by any Product, the key field cannot be updated.

```json

{
  "non_field_errors": "Attribute is used by Product(s). Can not update attribute_key field!",
  "error_code": "attribute_200_4"
}

```

There are some reserved keys which cannot be used to create attributes. Reserved keys are Product model fields excluding description, brand, weight and tax\_rate. Check the Product section to see the entire reserved key list.

```json

{
  "non_field_errors": "Requested key name cannot be used. modified_date is reserved.",
  "error_code": "attribute_200_6"
}

```


# Attribute Value

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product attribute values. By leveraging these methods, users can retrieve, create, update, and search product attribute values, allowing for seamless integration and management of product data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product attribute value API.

## <mark style="color:red;">Get Attribute Values</mark>

To get attribute values from the system, you can send the GET request. To filter, you can add parameters such as `value`, `value_exact`, `attribute` as in QueryString. If you don't add parameters for the filter, all attribute values in the system will be returned.

<table data-header-hidden><thead><tr><th width="123.3125"></th><th width="106.26171875"></th><th width="86.8046875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>value</td><td>string</td><td>query</td><td>It searches attributes that include the <em>value</em></td></tr><tr><td>value__exact</td><td>string</td><td>query</td><td>It searches attributes that match the <em>value</em> exactly</td></tr><tr><td>attribute</td><td>string</td><td>query</td><td>The ID of the <em>attribute</em> to which the <em>attribute value</em> is related</td></tr></tbody></table>

#### <mark style="color:red;">**Request GET**</mark>

GET request is used for retrieving current attribute values from the system. This request is expected to return all attribute value data according to page and limit parameters.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘limit’ determines how many attribute values are shown in the page. Default value is 10.

‘page’ determines the page of the retrieved results. Default value is 1.

**Path**:`attribute_value/`

<pre class="language-python"><code class="lang-python"><strong>import requests
</strong>
url = "https://{customer_api_url}/api/i1/attribute_value/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}
params = {
    'limit': 4,
    'page': 2
}

response = requests.get(url, headers=headers , params=params)
print(response.text)
</code></pre>

**Response**

Response contains all attribute value data with given parameters. Response status is expected to be HTTP-200 Successful.

Resource properties are in Python format.

| **Parameter** | **Data Type** | **Description**                                                     |
| ------------- | ------------- | ------------------------------------------------------------------- |
| attribute     | id            | The id of the *attribute* to which the *attribute value* is related |
| value         | string        | Attribute's value                                                   |
| label         | string        | Attribute's label. It is used on the back office frontend.          |
| order         | int           | Order                                                               |
| erp\_code     | string        | Attribute's value code in ERP                                       |

“count” shows how many attribute values exist in the system.

“next” shows the next cursor url to retrieve the desired attribute values.

“previous” shows the previous cursor url to retrieve the desired attribute values.

“results” shows every attribute value detail.

```json

{
  "count": 498,
  "next": "https://{customer_api_url}/api/i1/attribute_value/attribute_value/?limit=4&page=2",
  "previous": null,
  "results": [
    {
      "pk": 3672,
      "attribute": 158,
      "value": "40/41",
      "order": null,
      "label": null,
      "erp_code": "40/41",
    },
    {
      "pk": 3673,
      "attribute": 158,
      "value": "26-30",
      "order": null,
      "label": null,
      "erp_code": "26-30",
    },
    {
      "pk": 3674,
      "attribute": 158,
      "value": "26-32",
      "order": null,
      "label": null,
      "erp_code": "26-32",
    },
    {
      "pk": 3675,
      "attribute": 158,
      "value": "36/37",
      "order": null,
      "label": null,
      "erp_code": "36/37",
    }
  ]
}

```

## <mark style="color:red;">Search Attribute Value</mark>

Filter attribute values in the system with allowed fields using a GET request. The table below shows the filtering options with details. If a user doesn’t add any filtering options in the query, all of the attribute values will be returned in the system.

<table data-header-hidden><thead><tr><th width="137.40234375"></th><th width="119.99609375"></th><th width="114.48828125"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>value</td><td>string</td><td>query</td><td>It searches attributes that include the <em>value</em></td></tr><tr><td>value__exact</td><td>string</td><td>query</td><td>It searches attributes that match the <em>value</em> exactly</td></tr><tr><td>attribute</td><td>string</td><td>query</td><td>The ID of the <em>attribute</em> to which the <em>attribute value</em> is related</td></tr><tr><td>label</td><td>string</td><td>query</td><td>It searches the attribute values that include the label</td></tr><tr><td>erp_code</td><td>string</td><td>query</td><td>It searches the attribute values that include the erp_code</td></tr></tbody></table>

#### <mark style="color:red;">**Request GET**</mark>

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘django\_language’ cookies allow you to retrieve desired language values. ‘Attribute Value’ field is a translatable field. If there are no translations with the given language code, the response shows the default language value.

The sample request below filters all attribute values related to the attributes with ID 205.

Path:`<code>i1/attribute_value/</code></strong>`

```python
import requests

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

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}
cookies = {
    'django_language':'en-us' # searches values in English
}

params = {
    'attribute': '205' #attribute id
}

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

**Response**

Response contains all attribute value data with search parameters. Response status is expected to be HTTP-200 Successful. Resource properties are in Python format.

| **Parameter** | **Data Type** | **Description**                                                     |
| ------------- | ------------- | ------------------------------------------------------------------- |
| attribute     | id            | The ID of the *attribute* to which the *attribute value* is related |
| value         | string        | Attribute's value                                                   |
| order         | int           | Attribute value’s order                                             |
| label         | string        | Attribute's label. It is used in the back-end front-end.            |
| erp\_code     | string        | Attribute value’s code in ERP                                       |

“count” shows how many attribute values exist in the system with used filter options.

“next” shows the next cursor url to retrieve the desired attribute values.

“previous” shows the previous cursor url to retrieve the desired attribute values.

“results” shows every attribute value detail.

```json
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 5214,
      "attribute": 205,
      "value": "2051",
      "order": 1,
      "label": "dark green ",
      "erp_code": "erp-2051",
    }
  ]
}
```

#### <mark style="color:red;">**Request GET ​**</mark>

Below request is for retrieving Turkish values of the attribute values. Language is controlled by the ‘django\_language’ cookie or ‘Accept-Language’ header. If the attribute value does not have translations for the given language code, it returns the default value.

Path: `v1/attribute_value/`

```python

import requests
url = "https://{customer_api_url}/api/i1/attribute_value/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}
cookies = {
    'django_language':'tr-tr' # searches values in Turkish
}
params = {
    'attribute': '205' #attribute id
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)
print(response.text)

```

**Response**

Response contains all attribute value data with search parameters. Response status is expected to be HTTP-200 Successful. Resource properties are in Python format.

| **Parameter** | **Data Type** | **Description**                                                     |
| ------------- | ------------- | ------------------------------------------------------------------- |
| attribute     | id            | The ID of the *attribute* to which the *attribute value* is related |
| value         | string        | Attribute's value                                                   |
| order         | int           | Attribute value’s order                                             |
| order         | string        | Attribute's label. It is used on the back office front end.         |
| erp\_code     | string        | Attribute value’s code in ERP                                       |

“count” shows how many attribute values exist in the system with used filter options.

“next” shows the next cursor url to retrieve the desired attribute values.

“previous” shows the previous cursor url to retrieve the desired attribute values.

“results” shows every attribute value detail.

```json

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 5214,
      "attribute": 205,
      "value": "2051",
      "order": 1,
      "label": "koyu yesil",
      "erp_code": "erp-2051",
    }
  ]
}

```

## <mark style="color:red;">Create Attribute Value</mark>

Attribute value must be attached to an attribute. For this reason, attribute ID also must be sent when creating an attribute value. How to get attribute ID and other details are explained under [Search Attribute](/omnitron/integration/product/attribute#search-attribute) section.

| **Parameter**  | **Data Type** | **In** | **Required** | **Description**                                                    |
| -------------- | ------------- | ------ | ------------ | ------------------------------------------------------------------ |
| api\_token     | string        | header | YES          | [The API key of the customer’s account](/omnitron/getting-started) |
| attribute\_key | id            | body   |              | How attributes are saved in DB. (Ex: color, size).                 |
| attribute      | id            | body   | YES          | The ID of attribute to which the attribute value is related        |
| value          | string        | body   | YES          | Attribute's value                                                  |
| label          | string        | body   |              | Attribute's label. It is used in the backend and frontend          |
| order          | int           | body   |              | Order                                                              |
| erp\_code      | string        | body   | YES          | Attribute's value code in ERP                                      |

#### <mark style="color:red;">**Request POST**</mark>

POST request is needed for creating a new attribute value.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

The ‘Translation’ key is used to add different language translations for the attribute value.

Path: `v1/attribute_value/`

```json

import requests
url = "https://{customer_api_url}/api/i1/attribute_value/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token)
}
cookies = {
    'django_language':'en-us' #default Omnitron language
}
data = {
        'attribute' : '160',
        'label': 'dark green', # in default language
        'translations': {
            'de-de':{
                'label':'dunkelgrün' # in German
                },
        },   
        'value': '1606',
        'erp_code': 'erp-1606',
        'order': 1
}
response = requests.post(url, headers=headers, cookies=cookies , data=json.dumps(data))
print(response.text)


```

**Response​**

Returns the created attribute value data. Response status is expected to be HTTP-201 Created. Resource Properties are in Python format.

The table below shows the field details of the created attribute value.

| **Parameter** | **Data Type** | **Description**                                                 |
| ------------- | ------------- | --------------------------------------------------------------- |
| api\_token    | id            | The ID of the attribute to which the attribute value is related |
| value         | string        | Attribute's value                                               |
| label         | string        | Attribute's label. It is used in the backend and frontend       |
| order         | int           | Order                                                           |
| erp\_code     | string        | Attribute's value code in ERP                                   |

```python

{
  "pk": 5211,
  "attribute": 160,
  "value": "1606",
  "order": 1,
  "label": "dark green",
  "erp_code": "erp-1606",
}

```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

“Erp\_code” and “value” are unique fields and don’t accept duplicate data.

```python

{
  "non_field_errors": "(erp_code:erp_color) is already exists",
  "error_code": "attribute__value_201_1"
}
```

```python

{
  "non_field_errors": "(value:value) is already exists",
  "error_code": "attribute__value_201_1"
}
```

## <mark style="color:red;">Update Attribute Value</mark>

To update the value of the attribute, it is necessary to know the ID of the attribute value. How to get ID and other details are explained under [Search Attribute Value](broken://pages/V3oeSK2Is6Ze6Gy9D6iq) section.

| **Parameter**  | **Data Type** | **In** | **Description**                                                     |
| -------------- | ------------- | ------ | ------------------------------------------------------------------- |
| api\_token     | string        | header | [The API key of the customer’s account](/omnitron/getting-started)  |
| value          | string        | query  | It searches attributes that include the *value*                     |
| value\_\_exact | string        | query  | It searches attributes that match the *value* exactly               |
| attribute      | string        | query  | The ID of the *attribute* to which the *attribute value* is related |

#### <mark style="color:red;">**Request PATCH**</mark>

Request sample to update an attribute value. Attribute Value ID is required to perform this action. If the given ID is not found in the system, the response code is: 404 Not Found.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path:`/api/i1/attribute_value/&lt;ATTRIBUTE_VALUE_ID>/`

```python

import requests

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

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

cookies = {
    'django_language':'tr-tr'
}

data = {
        'label':'koyu yesil',
        'translations': {
            'en-us':{
                'label':'dark green'
                }
        },
}

response = requests.patch(url, headers=headers, cookies=cookies , data=json.dumps(data))
print(response.text)

```

**Response​**

Returns the updated version of the attribute value fields. Resource Properties are in Python format.

| **Parameter** | **Data Type** | **Description**                                                 |
| ------------- | ------------- | --------------------------------------------------------------- |
| pk            | id            | The ID of the attribute value                                   |
| attribute     | id            | The ID of the attribute to which the attribute value is related |
| value         | string        | Attribute's value                                               |
| label         | string        | Attribute's label. It is used on the back office frontend       |
| order         | int           | Order                                                           |
| erp\_code     | string        | Attribute value’s code in ERP                                   |

```json

{
  "pk": 5214,
  "attribute": 205,
  "value": "2051",
  "order": 1,
  "label": "koyu yesil",
  "erp_code": "erp-2051",
}

```

**Bad Request Responses**

When the requested action cannot be performed, API gives an explanation about the request.

“erp\_code” is a unique field and does not accept duplicate data.

```json

{
  "non_field_errors": "(erp_code:erp_color) is already exists",
  "error_code": "attribute__value_201_1"
}
```

“value” is a unique field.

```json

{
  "non_field_errors": "(value:value) is already exists",
  "error_code": "attribute__value_201_1"
}
```

If any product is using the “attribute\_value”, the value of it cannot be updated.

```json

{
  "non_field_errors": "AttributeValue can not be updated",
  "error_code": "attribute__value_201_2"
}
```


# Attribute Set

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product attribute sets. By leveraging these methods, users can retrieve, create, and search product attribute sets, allowing for seamless integration and management of product data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product attribute set API.

## <mark style="color:red;">Get Attribute Sets</mark>

Attribute sets are created by grouping attributes via attribute configs. Television, mobile phone, sneakers, t-shirt, and sofa can have different attribute(s) sets.

**Note:** Before creating a product, the "attribute set" that the product will have should be decided.

| **Parameter** | **Data Type** | **In** | **Description**                                                    |
| ------------- | ------------- | ------ | ------------------------------------------------------------------ |
| api\_token    | string        | header | [The API key of the customer’s account](/omnitron/getting-started) |
| limit         | integer       | body   | Amount of line items per page that will be returned                |
| page          | string        | body   | Page number to return                                              |

#### <mark style="color:red;">**Request GET**</mark>

Retrieves the entire attribute sets in the database. To filter the results check the *Attribute Sets Search* section.

Path:`i1/attribute_set/`

```python
import requests

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

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

params = {
    'limit': '1',
    'page': '3'
}

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

**Response**

Response contains all attribute sets data with search parameters. Response status is expected to be HTTP-200 Successful.

Resource Properties are in Python format.

<table data-header-hidden><thead><tr><th width="177.10546875"></th><th width="136.11328125"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Description</strong></td></tr><tr><td>name</td><td>string</td><td>Set's name</td></tr><tr><td>attribute_set_type</td><td>dict</td><td>Type of the attribute set. It could be simple or group</td></tr><tr><td>value</td><td>string</td><td>Attribute set's value</td></tr><tr><td>label</td><td>string</td><td>Attribute set's label. It is used in the backend and frontend</td></tr><tr><td>attributeconfig_set</td><td>array</td><td>List of attributes included in the attribute set</td></tr></tbody></table>

“count” shows how many attribute sets exist in the system.

“next” shows the next cursor url to retrieve the desired attribute sets.

“previous” shows the previous cursor url to retrieve the desired attribute sets.

“results” shows every attribute sets detail.

```json

{
  "count": 56,
  "next": "https://{customer_api_url}/api/i1/attribute_set/?limit=1&page=4",
  "previous": "https://{customer_api_url}/api/i1/attribute_set/?limit=1&page=2",
  "results": [
    {
      "id": 116,
      "name": "Beden-Renk",
      "attribute_set_type": {
        "value": "simple",
        "label": "Simple"
      },
      "attributeconfig_set": [
        {
          "pk": 2620,
          "attribute": {
            "pk": 1061,
            "key": "oms_excluded",
            "data_type": "dropdown",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "Lorem Ipsum",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "oms_excluded",
            "pre_attribute": false,
            "description": "",
          },
          "attribute_set": 116,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 0,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        },
        {
          "pk": 2587,
          "attribute": {
            "pk": 206,
            "key": "akinon_filterable_size",
            "data_type": "dropdown",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "Size",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "filterable_size",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 116,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 1,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        },
        {
          "pk": 2191,
          "attribute": {
            "pk": 167,
            "key": "top_category",
            "data_type": "text",
            "default_value": null,
            "is_required": false,
            "is_visible": false,
            "is_searchable": false,
            "is_filterable": false,
            "is_variant": true,
            "is_variant_listable": false,
            "name": "top_category",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "top_category",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 116,
          "is_required": false,
          "is_visible": false,
          "is_searchable": false,
          "is_filterable": false,
          "is_variant": true,
          "is_variant_listable": false,
          "default_fields": [
            "is_localizable"
          ],
          "order": 4,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        },
        {
          "pk": 1898,
          "attribute": {
            "pk": 160,
            "key": "Variant-Product1",
            "data_type": "price",
            "default_value": null,
            "is_required": true,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": true,
            "is_variant_listable": true,
            "name": "Variant Product1",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "Variant Product",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 116,
          "is_required": true,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": true,
          "is_variant_listable": true,
          "default_fields": [
            "is_localizable"
          ],
          "order": 7,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        },
        {
          "pk": 1897,
          "attribute": {
            "pk": 269,
            "key": "Forbidden",
            "data_type": "bool",
            "default_value": null,
            "is_required": false,
            "is_visible": false,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "forbidden",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "forbidden",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 116,
          "is_required": false,
          "is_visible": false,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_localizable"
          ],
          "order": 8,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        },
        {
          "pk": 1896,
          "attribute": {
            "pk": 599,
            "key": "density",
            "data_type": "text",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "density",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "density",
            "pre_attribute": false,
            "description": "Density"
          },
          "attribute_set": 116,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_localizable"
          ],
          "order": 9,
          "is_form_required": false,
          "is_form_field_required": false,
          "modified_date": "2022-02-21T08:13:40.424413Z",
          "created_date": "2016-12-14T14:56:02.160001Z",
        }
      ]
    }
  ]
}

```

## <mark style="color:red;">Search Atrribute Set</mark>

To get attribute set from the system, you can send the GET request. To filter, you can add parameters `name` and `attribute_set_type` as in QueryString. If you don't add parameter for filter, all attribute sets in the system will be returned.

<table><thead><tr><th width="199.6328125">Parameter</th><th width="97.88671875">Data Type</th><th width="101.5390625">In</th><th>Description</th></tr></thead><tbody><tr><td><code>api_token</code></td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td><code>limit</code></td><td>integer</td><td>body</td><td>Amount of line items per page that will be returned</td></tr><tr><td><code>page</code></td><td>integer</td><td>body</td><td>Page number to return</td></tr><tr><td><code>name</code></td><td>string</td><td>body</td><td>Attribute set's name.</td></tr><tr><td><code>attribute_set_type</code></td><td>string</td><td>body</td><td><strong>simple</strong> or <strong>group</strong></td></tr></tbody></table>

#### **Request `GET`**

**Path**: `attribute_set/`

```python

import requests

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

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

params = {
    'name':'size',
    'attribute_set_type' : 'simple',
    'limit': 3,
    'page': 1
}

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

***

**Response**

Resource properties in Python format

| Property              | Data Type | Description                                                   |
| --------------------- | --------- | ------------------------------------------------------------- |
| `name`                | string    | Set's name                                                    |
| `attribute_set_type`  | dict      | It could be **simple** or **group**                           |
| `value`               | string    | Attribute set's value                                         |
| `label`               | string    | Attribute set's label. It is used on the backoffice frontend. |
| `attributeconfig_set` | array     | List of attributes included in the attribute set              |

```json
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 512,
      "name": "MPColorSize",
      "attribute_set_type": {
        "value": "simple",
        "label": "Simple"
      },
      "attributeconfig_set": [
        {
          "pk": 1873,
          "attribute": {
            "pk": 665,
            "key": "mp_color",
            "data_type": "valuelabel",
            "default_value": null,
            "is_required": true,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": true,
            "is_variant_listable": true,
            "name": "MP Color",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_color",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": true,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": true,
          "is_variant_listable": true,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 0,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 1874,
          "attribute": {
            "pk": 666,
            "key": "mp_size",
            "data_type": "valuelabel",
            "default_value": null,
            "is_required": true,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": true,
            "is_variant_listable": false,
            "name": "MP Size",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_size",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": true,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": true,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 1,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 1875,
          "attribute": {
            "pk": 667,
            "key": "mp_filterable_color",
            "data_type": "dropdown",
            "default_value": 4035,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "MP Filtrable Color",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_filterable_color",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 2,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 1876,
          "attribute": {
            "pk": 668,
            "key": "mp_filterable_size",
            "data_type": "dropdown",
            "default_value": 4042,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "MP Filtrable Size",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_filterable_size",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 3,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 1877,
          "attribute": {
            "pk": 669,
            "key": "mp_description",
            "data_type": "text",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "MP Description",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_description",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 4,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 1878,
          "attribute": {
            "pk": 670,
            "key": "mp_gender",
            "data_type": "dropdown",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": false,
            "is_variant": false,
            "is_variant_listable": true,
            "name": "MP Gender",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "mp_gender",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 512,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": false,
          "is_variant": false,
          "is_variant_listable": true,
          "default_fields": [
            "is_required",
            "is_visible",
            "is_searchable",
            "is_filterable",
            "is_variant",
            "is_variant_listable",
            "is_localizable",
            "is_form_required",
            "is_form_field_required"
          ],
          "order": 5,
          "is_form_required": false,
          "is_form_field_required": false
        }
      ]
    }
  ]
}
```

## <mark style="color:red;">Create Attribute Set</mark>

To add an attribute to an attribute set, the attribute set must first be created. After creating an attribute set, attributes can be added to the attribute set. Attribute set is used by grouping attributes. This way you can manage the same type of products with attribute sets, such as Phones, Televisions, etc.

| **Parameter**        | **Data Type** | **In** | **Description**                                                    |
| -------------------- | ------------- | ------ | ------------------------------------------------------------------ |
| api\_token           | string        | header | [The API key of the customer’s account](/omnitron/getting-started) |
| name                 | string        | body   | Set's name.                                                        |
| attribute\_set\_type | string        | body   | It could be simple or group                                        |

#### <mark style="color:red;">**Request POST**</mark>

`POST` request is used to create a new attribute set object.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘Accept-language’ header determines translatable fields responses.

Path:`/v1/attribute_set/`

```json

import requests
import json

url = "https://{customer_api_url}/api/v1/attribute_set/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-Language': 'en-us'
}

data = {
    "attribute_set_type": "simple",
    "name": "test_shirt_attribute_set"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response​**

Returns the created attribute set. Successful response status is expected to be HTTP-201 Created.

Resource properties are in Python format.

```python

{
  "pk": 1108,
  "name": "test_shirt_attribute_set",
  "attribute_set_type": "simple",
  "attributeconfig_set": [],
  "description": null,
  "modified_date": "2022-02-21T08:13:40.424413Z",
  "created_date": "2016-12-14T14:56:02.160001Z,
}

```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

“name” is a unique field and cannot accept duplicate data.

```python

{
  "non_field_errors": "(name:test) already exists",
  "error_code": "attribute_set_202_1"
}
```

## <mark style="color:red;">**Create Attribute Config**</mark>

Attribute Configs are used for adding an attribute to the attribute set. You can configure attribute properties via AttributeConfig. For example, an attribute’s property ‘is\_filterable’ is *True*, and in an attribute set you want to make it *False*. You can do it by changing ‘is\_filterable’ filter value while creating Attribute Config.

<table data-header-hidden><thead><tr><th width="128.6015625"></th><th width="104.015625"></th><th width="83.88671875"></th><th width="94.62109375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>YES</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>attribute</td><td>id</td><td>body</td><td>YES</td><td>Attribute ID</td></tr><tr><td>attribute_set</td><td>id</td><td>body</td><td>YES</td><td>Attribute set ID</td></tr><tr><td>is_filterable</td><td>boolean</td><td>body</td><td>YES</td><td>(default False) If the parameter is True, this attribute can be viewed in filters</td></tr><tr><td>is_required</td><td>boolean</td><td>body</td><td>YES</td><td>(default False). It determines whether the attribute value can be left blank when creating or updating the product. If this parameter is True in the attribute set, this attribute must be required in the product</td></tr><tr><td>is_searchable</td><td>boolean</td><td>body</td><td>YES</td><td>(default True) If the parameter is True, the customer can search with the value of the attribute on the website</td></tr><tr><td>is_variant</td><td>boolean</td><td>body</td><td>YES</td><td>(default False) If the parameter is True for the size attribute, it is possible to make variants such as X size sweater, L size sweater among child products connected to the same parent product.</td></tr><tr><td>is_variant_listable</td><td>boolean</td><td>body</td><td>YES</td><td>(default False) Determines whether different variants of the same product will appear on the product listing page</td></tr><tr><td>is_visible</td><td>boolean</td><td>body</td><td>YES</td><td>(default True) Determines whether the attribute will appear on the website. "_False” could be selected for attributes that will be used at the back office (Omnitron) and not used on the website. For example, ERP color code, ERP SKU, etc.</td></tr><tr><td>is_form_required</td><td>boolean</td><td>body</td><td>YES</td><td>(default False) The customer needs to fill out a form when adding a product whose <strong>is_form_required</strong> value is True to the cart. Such as the name and note to be written on the jewelry, watches, wallets, flowers.</td></tr><tr><td>is_form_field_required</td><td>boolean</td><td>body</td><td>YES</td><td>(default False) It determines whether the fields in the form (associated with "is_form_required”) shown to the customer are required</td></tr><tr><td>order</td><td>integer</td><td>body</td><td></td><td>Attribute's order in the attribute set</td></tr></tbody></table>

#### <mark style="color:red;">**Request POST**</mark>

Attribute Configs are used for attributes in the Attribute Set. With Attribute Config attribute settings can be adjustable.

Path:`/v1/attribute_config/`

```json

import requests
import json

url = "https://{customer_api_url}/api/v1/attribute_config/`"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'content-type': 'application/json',
    'Authorization': 'Token {}'.format(api_token),
    'Accept-Language': 'en-us'
}

data = {
    "attribute": 668,
    "attribute_set": 1108,
    "is_filterable": False,
    "is_required": False,
    "is_searchable": True,
    "is_variant": False,
    "is_variant_listable": False,
    "is_visible": True,
    "is_form_required": False,
    "is_form_field_required": False,
    "order": 0
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns the created attribute config details.

```python
{
  "pk": 3383,
  "attribute": 668,
  "attribute_set": 1108,
  "is_required": false,
  "is_visible": true,
  "is_searchable": true,
  "is_filterable": false,
  "is_variant": false,
  "is_variant_listable": false,
  "default_fields": [
    "is_localizable"
  ],
  "order": 0,
  "is_form_required": false,
  "is_form_field_required": false,
  "modified_date": "2022-02-21T08:13:40.424413Z",
  "created_date": "2016-12-14T14:56:02.160001Z,
}
```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

“attribute-attribute\_set” is a unique field.

```python


{
  "non_field_errors": "(attribute:test) (attribute_set:test) already exists",
  "error_code": "attribute_set_203_1"
}
```

If an attribute is a variant attribute, it cannot be in a custom attribute set.

```python

{
  "non_field_errors": "Attribute config custom attribute set validation error. Custom attribute set doesn't accept variant attribute",
  "error_code": "attribute_set_203_3"
}
```

An attribute cannot be in both a custom attribute set and an attribute set.

```python

{
  "non_field_errors": "This attribute cannot exist in custom attribute set and attribute set",
  "error_code": "attribute_set_203_4"
}
```


# Product Image

This service has upsert logic. If a given `product_sku` exists in the system, the product image will be updated with the given parameters. If there is no image for the product SKU, it will be created. Data that is not included in the request will be deleted even if it was added before.

**Note**: Image URLs must be accessible for "Omnitron" in order for the images to be uploaded to the CDN.

| **Parameter** | **Data Type** | **In** | **Required** | **Description**                                                                                                               |
| ------------- | ------------- | ------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| api\_token    | string        | header | YES          | [The API key of the customer’s account](/omnitron/getting-started)                                                            |
| product\_sku  | string        | body   | YES          | Product SKU                                                                                                                   |
| images        | dict          | body   | YES          | Images dictionary. It has **url** and **order** keys                                                                          |
| url           | string        | body   | YES          | Image URL                                                                                                                     |
| unit\_type    | string        | body   |              | <p>Stocked quantity type.<br>qty: Quantity</p>                                                                                |
| order         | integer       | body   |              | Image order. Default\_value = 0                                                                                               |
| image\_type   | string        | body   |              | Default or swatch. Swatch is a thumbnail image which is used to show product variants on the website. Defaul\_value = default |

## <mark style="color:red;">Insert and Update Images</mark>

#### <mark style="color:red;">**Request POST**</mark>

It is used to replace existing `downloadable_image` objects with new images or to add images to products that do not have images. Images of the product must be sent in a single request. When more than one image is wanted to be added, if any of them is wrong, none of the images will be added.

Downloadable image(s) the product has, but not in the request body, will be deleted.

Downloadable image(s) the product has also in the request body will be updated with `order` and `image_type` values.

Downloadable images just in the request body will be created.

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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


data = {
    'product_sku': '1182701025',
    'images': [
        {'url': 'https://url/image1.png',
         'order': 0
         'image_type': 'swatch'
        },
        {'url': 'https://url/image2.png',
         'order': 1
        }
    ]
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns the data of the successfully added images.

```json

{
    "product_sku": "1182701025",
    "images": [
        {
            "id": 676599,
            "url": "https://url/image1.png",
            "order": 0,
            "image_type": "swatch"
        },
        {
            "id": 676600,
            "url": "https://url/image2.png",
            "order": 1,
            "image_type": "default"
        }
    ]
}
```

## <mark style="color:red;">Retrieve Images</mark>

#### <mark style="color:red;">**Request GET**</mark>

In order to access the image data of all products, a request can be made without adding any parameters.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `api/i1/downloadable_image/`

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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

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

```

**Response**

When the request is sent without adding any parameters, the image data of all products will be listed on the basis of SKU.

“count” shows how many products exist in the system.

“next” shows the next page url to retrieve the desired image data.

“previous” shows the previous page url to retrieve the desired image data.

“results” shows every image property with detailed field descriptions.

Images are listed in the “images” area of each product.

```json

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "product_sku": "1182701025",
      "images": [
        {
          "id": 676599,
          "url": "https://url/image1.png",
          "order": 0,
          "image_type": "swatch"
        },
        {
          "id": 676600,
          "url": "https://url/image2.png",
          "order": 1,
          "image_type": "default"
        }
      ]
    },
    {
      "product_sku": "7832783278",
      "images": [
        {
          "id": 676601,
          "url": "https://url/image3.png",
          "order": 0,
          "image_type": "swatch"
        },
        {
          "id": 676602,
          "url": "https://url/image4.png",
          "order": 1,
          "image_type": "default"
        }
      ]
    }
  ]
}
```

## <mark style="color:red;">Retrieve All Images for Given SKU</mark>

#### <mark style="color:red;">**Request GET**</mark>

When you want to list images of a particular product, information can be accessed by adding `product_sku`information as a query parameter.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `api/i1/downloadable_image/`

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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

response = requests.get(url, headers=headers, params={"product_sku": "1182701025"})
print(response.text)

```

**Response**

The ID, URL, order and `image_type` information of the images of the specified product will be listed as a response.

```json

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "product_sku": "1182701025",
      "images": [
        {
          "id": 676599,
          "url": "https://url/image1.png",
          "order": 0,
          "image_type": "swatch"
        },
        {
          "id": 676600,
          "url": "https://url/image2.png",
          "order": 1,
          "image_type": "default"
        }
      ]
    }
  ]
}
```

## <mark style="color:red;">Delete All Images</mark>

#### <mark style="color:red;">**Request POST**</mark>

Every image for a product with the given SKU can be removed with the following request:

Path: `api/i1/downloadable_image/`

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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


data = {
    'product_sku': '1182701025',
    'images': [
    ]
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

If the deletion is successful, the transmitted data will be displayed in the response.

```json

{
  "product_sku": "1182701025",
  "images": [
  ]
}

```

## <mark style="color:red;">Delete a Single Image</mark>

#### <mark style="color:red;">**Request POST**</mark>

To delete a single image for a product, an image list should be sent without the image to be deleted.

Path: `api/i1/downloadable_image/`

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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

response = requests.get(url, headers=headers, params={"product_sku": "1182701025"})

data = response.json()
data = data["results"][0]
data["images"].pop()

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

After the request is sent, all images belonging to the product will be sent as a response.

```json

{
  "product_sku": "1182701025",
  "images": [
    {
      "id": 676599,
      "url": "https://url/image1.png",
      "order": 0,
      "image_type": "default"
    }
  ]
}
```

## <mark style="color:red;">Update Order and Image Type</mark>

#### <mark style="color:red;">**Request POST**</mark>

To update any field, the POST request should be sent with the original data and the updated field.

Default order value is 0 if not sent with request.

Default image type value is default if not sent with request.

The data that already exists but is not included in the request for the update will be deleted.

Path: `api/i1/downloadable_image/`

```python

import requests
import json

url = "https://{customer_api_url}/api/i1/downloadable_image/"
api_token = "f532e28df6e4d5fa4648a812018876da1bb9332d"

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

response = requests.get(url, headers=headers, params={"product_sku": "1182701025"})

data = response.json()
data = data["results"][0]

data["images"][0]["order"] = 5
data["images"][1]["order"] = 6

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Edited or newly added data will be listed in the response.

```json

{
  "product_sku": "1182701025",
  "images": [
    {
      "id": 676599,
      "url": "https://url/image1.png",
      "order": 5,
      "image_type": "default"
    },
    {
      "id": 676600,
      "url": "https://url/image2.png",
      "order": 6,
      "image_type": "default"
    }
  ]
}
```


# Price


# Price List

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle price lists. By leveraging these methods, users can retrieve, search, and create price lists, allowing for seamless integration and management of price list data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the price list API.

## <mark style="color:red;">Get Price List</mark>

PriceList is used to connect `ProductPrice` objects with catalog. Therefore, a catalog can have prices for its catalog items with this relation. PriceList and Catalog objects have `OneToMany` relationship. This means a PriceList can have relation with more than one catalog, while one catalog can only have one PriceList relation. However, with a new implementation for some clients, a PriceList can connect to the `extra_price_lists` field on a catalog object. Therefore, a catalog may also have more than one PriceList. This feature is for clients that want to have multiple price options for their different retail stores.

<table data-header-hidden><thead><tr><th width="144.40234375"></th><th width="117.3515625"></th><th width="107.625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>name</td><td>string</td><td>query</td><td>Price list name</td></tr><tr><td>limit</td><td>integer</td><td>query</td><td>Amount of line items per page that will be returned</td></tr><tr><td>page</td><td>string</td><td>query</td><td>Page number to return</td></tr></tbody></table>

**Note:** If limit and page parameters are not sent, response returns 10 product prices by default.

**Request GET**

GET request is used for reading current price lists from Omnitron (both i1 and v1 can be used). This request is expected to return all price lists data according to page and limit parameters.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `price_list/`

```python

import requests

url = "https://{customer_api_url}/api/v1/price_list/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

```

**Response**

Response contains all price list data with given parameters (if exist) and with pagination. Response status is expected to be HTTP-200 Successful. Only ‘v1’ contains ‘created\_date’ and ‘modified\_date’ fields.

Resource properties are in Python format.

| **Property**   | **Data Type** | **Description**                                                                                                                         |
| -------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| name           | string        | List name                                                                                                                               |
| code           | string        | The list ID in ERP                                                                                                                      |
| is\_auto\_sync | boolean       | Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP. |
| currency       | string enum   | Currency of the price list                                                                                                              |
| modified\_date | datetime      | Last modified date of the price list                                                                                                    |
| created\_date  | datetime      | Shows the date when the price list was created                                                                                          |

“count” shows how many price lists exist in the system.

“next” shows the next cursor url to retrieve the desired price list.

“previous” shows the previous page url to retrieve the desired price list.

“results” shows every price list property with detailed field descriptions for the current page.

```json

{
  "count": 3,
  "next": "https://{customer_api_url}/api/v1/price_list/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 1,
      "name": "Demo Price List",
      "code": null,
      "is_auto_sync": false,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    },
    {
      "pk": 2,
      "name": "Sync Price List",
      "code": "112",
      "is_auto_sync": true,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    },
    {
      "pk": 3,
      "name": "Shop Price List",
      "code": null,
      "is_auto_sync": false,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    }
  ]
}
```

## <mark style="color:red;">Search Price List</mark>

GET requests can be filtered with parameters. `price_list` endpoint gives the opportunity to make their GET request filtered according to PriceList fields.

<table data-header-hidden><thead><tr><th width="136.3046875"></th><th width="114.45703125"></th><th width="110.5546875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>name</td><td>string</td><td>query</td><td>Price list's name</td></tr><tr><td>limit</td><td>integer</td><td>query</td><td>Amount of items per page that will be returned</td></tr><tr><td>page</td><td>string</td><td>query</td><td>Page number to return</td></tr></tbody></table>

**Note:** If limit and page parameters are not sent, response returns 10 product prices by default.

**Request GET**

Standard GET request with parameters (both i1 and v1 can be used). Parameters are used to get PriceLists with conditions.

Example: params = {'name': 'price'} is expected to return price lists with names containing ‘price’.

‘code’, ‘is\_auto\_sync’ and ‘created\_date’ parameters can also be added.

**Example:**

```json
{
	`name’: ‘price’,
	‘is_auto_sync’: True,
	‘code’: ‘default’,
	‘created_date__date__gte’: ‘2022-01-01’
} 

```

**Note:**

\['gt', 'gte', 'lt', 'lte', 'date\_\_gt', 'date\_\_gte', 'date\_\_lt', 'date\_\_lte'] lookup keys can be used for created\_date field. `code__exact` parameter can be used to get an exact match for the code field.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `price_list/`

```python
import requests

url = "https://{customer_api_url}/api/v1/price_list/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

params = {
    'name': 'price'
}

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

**Response**

Response contains all price list data with search parameters and with pagination. Response status is expected to be HTTP-200 Successful.

Only ‘v1’ contains ‘created\_date’ and ‘modified\_date’ fields.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="158.36328125"></th><th width="149.6875"></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>name</td><td>string</td><td>List name</td></tr><tr><td>code</td><td>string</td><td>The list ID in ERP</td></tr><tr><td>is_auto_sync</td><td>boolean</td><td>Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP.</td></tr><tr><td>currency</td><td>EnumField</td><td>Currency of the price list</td></tr><tr><td>modified_date</td><td>datetime</td><td>Last modified date of the price list</td></tr><tr><td>created_date</td><td>datetime</td><td>Shows the date when the price list was created</td></tr></tbody></table>

“count” shows how many price lists exist in the system.

“next” shows the next page url to retrieve the desired price list.

“previous” shows the previous page url to retrieve the desired price list.

“results” shows every price list property with detailed field descriptions.

```json
{
  "count": 3,
  "next": null,
  "previous": null,
  "results": [

    {
      "id": 696,
      "name": "Shop Price List v02",
      "code": "Shop Price List v02",
      "is_auto_sync": true,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    },
    {
      "id": 697,
      "name": "Example Price List",
      "code": "example_price_list",
      "is_auto_sync": true,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    },
    {
      "id": 698,
      "name": "Example Price List 2",
      "code": "example_price_list_2",
      "is_auto_sync": true,
      "currency": "try",
      "modified_date": "2022-03-02T09:20:07.171465Z",
      "created_date": "2022-03-02T09:20:07.171453Z"
    }
  ]
}
```

## <mark style="color:red;">Create Price List</mark>

The prices of the products are kept in the price list. Therefore, before defining a price for a product, if there is no price list, it is necessary to define a price list first.

<table data-header-hidden><thead><tr><th width="116.02734375"></th><th width="109.92578125"></th><th width="87.1484375"></th><th width="98.5625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>YES</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>name</td><td>float</td><td>body</td><td>YES</td><td>List name</td></tr><tr><td>code</td><td>string</td><td>body</td><td>YES</td><td>The list ID in ERP</td></tr><tr><td>is_auto_sync</td><td>id</td><td>body</td><td>YES</td><td>Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP. If it is False, price creation and updating processes are managed in Omnitron with excel.</td></tr><tr><td>currency</td><td>EnumField</td><td>body</td><td>YES</td><td>Currency of the price list.<br>Default value is “try”</td></tr></tbody></table>

**Request POST**

POST request is used to create a new price list.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

‘name’ and ‘code’ fields should be unique.

Path: `v1/price_list/`

```python

import requests
import json

url = "https://{customer_api_url}/api/v1/price_list/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
    'name': 'shop_price_list_v03',
    'code': 'shop_price_list_v03',
    'is_auto_sync': True,
    'currency': 'usd',    
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns the created object data, after successfully creating the object. Response status is expected to be HTTP-201 Created.

Resource properties are in Python format.

| **Property**   | **Data Type** | **Description**                                                                                                                         |
| -------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| pk             | int           | Primary key of the created list                                                                                                         |
| name           | string        | List name                                                                                                                               |
| code           | string        | The list ID in ERP                                                                                                                      |
| is\_auto\_sync | boolean       | Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP. |
| modified\_date | date          | Last modified date of the price list                                                                                                    |
| created\_date  | date          | Shows the date when the price list was created                                                                                          |
| currency       | string enum   | Currency of the price list                                                                                                              |

```python

{
  "pk": 697,
  "name": "shop_price_list_v03",
  "code": "shop_price_list_v03",
  "is_auto_sync": true,
  "modified_date": "2021-07-12T08:05:37.190931Z",
  "created_date": "2021-07-12T08:05:37.190905Z",
  "currency": "usd"
}
```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

While creating a price list, if `is_auto_sync` is \_True \_and `code` is *None*, then the below error appears.

```python
{
    'non_field_errors': u'PriceList code is required when is_auto_sync is True.',
    'error_code': u'product_price_300_2'
}
```

‘name’ and ‘code’ fields should be unique.

```python
{
    'name': [ErrorDetail(string=u'price list with this name already exists.', code=u'unique')]
}
```

```python
{
    'code': [ErrorDetail(string=u'price list with this code already exists.', code=u'unique')]
}
```


# Product Price

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product prices. By leveraging these methods, users can retrieve, search, and create product prices, allowing for seamless integration and management of product price data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product price API.

## <mark style="color:red;">Get Product Price</mark>

Product Price is used to assign a price to a product. Product price objects relate to a price list. Thus, a catalog item can have a price via relation between the catalog, price list and product price.

<table data-header-hidden><thead><tr><th width="121.05078125"></th><th width="121.52734375"></th><th width="114.78125"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>limit</td><td>integer</td><td>query</td><td>Amount of items per page that will be returned</td></tr><tr><td>page</td><td>string</td><td>query</td><td>Page number to return</td></tr></tbody></table>

**Note:** If limit and page parameters are not sent, response returns 10 product prices by default.

**Request GET**

GET request is used for reading current product prices from Omnitron (both i1 and v1 can be used). This request is expected to return all product prices data according to page and limit parameters.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `product_price/`

```python

import requests

url = "https://{customer_api_url}/api/v1/product_price/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

params = {
    'limit': '2',
    'page': '1'
}

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

```

**Response**

Returns product prices as paginated. Successful response status is expected to be HTTP-200 OK. If ‘i1’ is used in the request, the response may not contain some of the below fields (properties).

Resource properties are in Python format.

| **Property**         | **Data Type**                                      | **Description**                                        |
| -------------------- | -------------------------------------------------- | ------------------------------------------------------ |
| product              | <p>Related product id<br>(product\_sku for i1)</p> | <p>Related product ID<br>(product\_sku for i1)</p>     |
| price                | float                                              | Product price                                          |
| currency\_type       | string enum                                        | Currency of the price field, default currency is ‘try’ |
| tax\_rate            | float                                              | Ad valorem tax rate (Ex: 18.00)                        |
| retail\_price        | float                                              | Retail price                                           |
| price\_list          | id                                                 | Price list which includes this product                 |
| discount\_percentage | float                                              | (retail\_price-price)/retail\_price)\*100              |
| extra\_field         | Json                                               | Campaign and discount info regarding the price         |
| modified\_date       | datetime                                           | Last modified date of the product price                |
| created\_date        | datetime                                           | Shows the date when the product price was created      |

“count” shows how many product prices exist in the system.

“next” shows the next cursor url to retrieve the desired product prices.

“previous” shows the previous page url to retrieve the desired product prices.

“results” shows every product price property with detailed field descriptions for the current page.

```json

{
  "count": 1013,
  "next": "https://{customer_api_url}/api/v1/product_price/?limit=2&page=2",
  "previous": null,
  "results": [
    {
            "pk": 2,
            "product": 913,
            "price": "62.44",
            "price_list": 1,
            "currency_type": "try",
            "tax_rate": "8.00",
            "retail_price": "249.75",
            "extra_field": {},
            "discount_percentage": "75.00",
            "modified_date": "2017-01-23T18:29:23.716095Z",
            "created_date": "2017-01-23T00:20:46.274433Z"
        },
        {
            "pk": 3,
            "product": 911,
            "price": "62.44",
            "price_list": 1,
            "currency_type": "try",
            "tax_rate": "8.00",
            "retail_price": "249.75",
            "extra_field": {},
            "discount_percentage": "75.00",
            "modified_date": "2017-01-23T18:29:22.861177Z",
            "created_date": "2017-01-23T00:20:46.321359Z"
        },
        {
            "pk": 4,
            "product": 910,
            "price": "62.44",
            "price_list": 1,
            "currency_type": "try",
            "tax_rate": "8.00",
            "retail_price": "249.75",
            "extra_field": {},
            "discount_percentage": "75.00",
            "modified_date": "2017-01-23T18:29:22.390819Z",
            "created_date": "2017-01-23T00:20:46.370001Z"
        }
  ]
}
```

## <mark style="color:red;">Create or Update Product Price</mark>

This service has the upsert logic. If the price list has the product SKU, the price of the product will be updated with the given parameters. If there is no product SKU available in the price list, a price will be created in the list with the product SKU.

To create or update the price of the product, it is necessary to know the ID of the price list. How to get the price list ID and other details are explained under this section.

<table data-header-hidden><thead><tr><th width="195.94921875"></th><th width="156.02734375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Description</strong></td></tr><tr><td>id</td><td>id</td><td>Product Price ID</td></tr><tr><td>product</td><td>id<br>string</td><td>Related product ID<br>(product_sku for i1)</td></tr><tr><td>price</td><td>float</td><td>Sale price</td></tr><tr><td>price_list</td><td>id</td><td>Price list which includes this product</td></tr><tr><td>currency_type</td><td>string enum</td><td>Currency unit</td></tr><tr><td>tax_rate</td><td>float</td><td>Body</td></tr><tr><td>retail_price</td><td>float</td><td>Retail price</td></tr><tr><td>discount_percentage</td><td>float</td><td>(retail_price-price)/retail_price)*100</td></tr><tr><td>extra_field</td><td>Json</td><td>Campaign and discount info for regarding price</td></tr></tbody></table>

**Request POST**

POST request is used to create a new product price object. ‘Product’ and ‘price\_list’ are unique\_together fields.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `i1/product_price/`

```python

import requests
import json

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

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

data = {
    "product": 1,
    "price": "62.44",
    "price_list": 6,
    "currency_type": "usd",
    "tax_rate": "8.00",
    "retail_price": "249.75"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns the created object data after successfully creating the object. Successful response status is expected to be HTTP-201 Created.

Resource properties are in Python format.

| **Property**   | **Data Type** | **Description**                                        |
| -------------- | ------------- | ------------------------------------------------------ |
| id             | integer       | ID number of product price                             |
| product\_sku   | string        | Product SKU                                            |
| price          | float         | Product price                                          |
| currency\_type | string enum   | Currency of the price field, default currency is ‘try’ |
| tax\_rate      | float         | Ad valorem tax rate (Ex: 18.00)                        |
| retail\_price  | float         | Retail price                                           |
| price\_list    | id            | Price list which includes this product                 |
| extra\_field   | Json          | Campaign and discount info for regarding price         |

```python

{
    "pk": 12842,
    "product": 1,
    "price": "62.44",
    "price_list": 6,
    "currency_type": "usd",
    "tax_rate": "8.00",
    "retail_price": "249.75",
    "extra_field": {},
}
```

**Bad Request Responses**

When the requested action cannot be executed, API gives an explanation about the request.

When creating a product price, `product` and `price_list` combination should be unique. Otherwise, the below error appears (‘product’ and ‘price\_list’ are unique\_together fields).

```python
{
    u'non_field_errors': [ErrorDetail(string=u'The fields product, price_list must make a unique set.', code=u'unique')]
}
```

`name` and `code` fields should be unique.

```python
{
    'name': [ErrorDetail(string=u'price list with this name already exists.', code=u'unique')]
}
```

```python
{
    'code': [ErrorDetail(string=u'price list with this code already exists.', code=u'unique')]
}
```

## <mark style="color:red;">Bulk Create or Update Product Price</mark>

This service has the same logic as the Create or Update Product Price Service. The only difference is that this service accepts a maximum of 10 instances to be updated or created at a time. It also accepts `batch_id` as a parameter which is described in the table below.

| **Parameter**        | **Data Type** | **Description**                                                                                                    | **Required**         |
| -------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------- |
| product\_\_sku       | string        | Product SKU field                                                                                                  | YES                  |
| price                | float         | Sale price                                                                                                         | YES                  |
| price\_list          | id            | Price list which includes this product                                                                             | YES                  |
| currency\_type       | string enum   | Currency unit                                                                                                      | NO. Default is ‘try’ |
| tax\_rate            | float         | Body                                                                                                               | NO                   |
| retail\_price        | float         | Retail price                                                                                                       | NO                   |
| discount\_percentage | float         | (retail\_price-price)/retail\_price)\*100                                                                          | NO                   |
| extra\_field         | Json          | Campaign and discount info regarding the price                                                                     | NO                   |
| batch\_id            | string        | Enables to track your actions. The value does not insert in the Omnitron Database. It will return in the response. | NO                   |

**Request POST**

POST request is used to create a new product price object. ‘Product’ and ‘price\_list’ are unique\_together fields.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `/api/i1/product_price/bulk_upsert/`

```python

import requests
import json

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

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

data = [
    {
        "product_sku": "SKU-001",
        "price": "62.44",
        "price_list": 6,
        "currency_type": "usd",
        "tax_rate": "8.00",
        "retail_price": "249.75",
        "batch_id": "2423uh2u-234-234-23-42342"
    },
    {
        "product_sku": "SKU-001",
        "price": "62.44",
        "price_list": 6,
        "currency_type": "usd",
        "tax_rate": "8.00",
        "retail_price": "249.75",
        "batch_id": "2423uh2u-234-234-23-42342"
    },
    {
        "product_sku": "SKU-003",
        "price": "62.44",
        "price_list": 6,
        "currency_type": "usd",
        "tax_rate": "8.00",
        "retail_price": "249.75",
        "batch_id": "2423uh2u-234-234-23-42342"
    },
]

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)

```

**Response**

Returns each object status information. Successful response status is expected to be HTTP-200 Successful.

Resource properties are in Python format.

| **Property**         | **Data Type** | **Description**                                                            |
| -------------------- | ------------- | -------------------------------------------------------------------------- |
| product\_\_sku       | string        | Product SKU                                                                |
| created\_or\_updated | boolean       | True means Product Price is created. False means Product Price is updated. |
| success              | boolean       | Shows whether the operation is successfully completed or not.              |
| batch\_id            | string        | Given batch\_id                                                            |
| errors               | string        | If the operation has failed, it shows the reason.                          |

```python
[
    {
        "sku": "SKU-001",
        "created_or_updated": False,
        "success": True,
        "batch_id": "2423uh2u-234-234-23-42342"
    },
    {
        "product_sku": "SKU-002",
        "created_or_updated": True,
        "success": True,
        "batch_id": "2423uh2u-234-234-23-42342"
    },
    {
        "product_sku": "SKU-003",
        "error": "Error Message",
        "success": False,
        "batch_id": "2423uh2u-234-234-23-42342"
    },
]
```


# Currency Unit Table

Currencies are defined as enum strings in Omnitron. The following table contains currencies in Omnitron.

<table data-header-hidden><thead><tr><th width="209.07421875"></th><th width="516.109375"></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Currency</strong></td></tr><tr><td><strong>eur</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/23px-Flag_of_Europe.svg.png" alt=""> Euro</td></tr><tr><td><strong>usd</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/20px-Flag_of_the_United_States.svg.png" alt=""> US Dolar</td></tr><tr><td><strong>egp</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Flag_of_Egypt.svg/23px-Flag_of_Egypt.svg.png" alt=""> Egyptian Pound</td></tr><tr><td><strong>gbp</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/Flag_of_the_United_Kingdom.svg/23px-Flag_of_the_United_Kingdom.svg.png" alt=""> British Pound</td></tr><tr><td><strong>mad</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Flag_of_Morocco.svg/23px-Flag_of_Morocco.svg.png" alt=""> Moroccan Dirham</td></tr><tr><td><strong>pln</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/1/12/Flag_of_Poland.svg/23px-Flag_of_Poland.svg.png" alt=""> Polish Złoty</td></tr><tr><td><strong>sar</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Flag_of_Saudi_Arabia.svg/23px-Flag_of_Saudi_Arabia.svg.png" alt=""> Saudi Riyal</td></tr><tr><td><strong>ron</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Flag_of_Romania.svg/23px-Flag_of_Romania.svg.png" alt=""> Romanian Leu</td></tr><tr><td><strong>uah</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Flag_of_Ukraine.svg/23px-Flag_of_Ukraine.svg.png" alt=""> Ukrainian Hryvnia</td></tr><tr><td><strong>czk</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_Czech_Republic.svg/23px-Flag_of_the_Czech_Republic.svg.png" alt=""> Czech Koruna</td></tr><tr><td><strong>huf</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Flag_of_Hungary.svg/23px-Flag_of_Hungary.svg.png" alt=""> Hungarian Forint</td></tr><tr><td><strong>rub</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/f/f3/Flag_of_Russia.svg/23px-Flag_of_Russia.svg.png" alt=""> Russian Ruble</td></tr><tr><td><strong>bgn</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Bulgaria.svg/23px-Flag_of_Bulgaria.svg.png" alt=""> Bulgarian Lev</td></tr><tr><td><strong>iqd</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Flag_of_Iraq.svg/23px-Flag_of_Iraq.svg.png" alt=""> Iraqi Dinar</td></tr><tr><td><strong>bhd</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Bahrain_flag_icon.png/23px-Bahrain_flag_icon.png" alt=""> Bahraini Dinar</td></tr><tr><td><strong>omr</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Oman_(77300)_-_The_Noun_Project.svg/23px-Oman_(77300)_-_The_Noun_Project.svg.png" alt=""> Omani Rial</td></tr><tr><td><strong>kwd</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/Kuwait_flag_icon.png/23px-Kuwait_flag_icon.png" alt=""> Kuwaiti Dinar</td></tr><tr><td><strong>qar</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Qatar_(77299)_-_The_Noun_Project.svg/23px-Qatar_(77299)_-_The_Noun_Project.svg.png" alt=""> Qatari Rial</td></tr><tr><td><strong>aed</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/United_Arab_Emirates_(77298)_-_The_Noun_Project.svg/23px-United_Arab_Emirates_(77298)_-_The_Noun_Project.svg.png" alt=""> U. Arab Emirates Dirham</td></tr><tr><td><strong>ngn</strong></td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Flag_of_Nigeria.svg/23px-Flag_of_Nigeria.svg.png" alt=""> Nigerian Naira</td></tr></tbody></table>

***


# Stock


# Stock List

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle stock lists. By leveraging these methods, users can retrieve, search, and create stock lists, allowing for seamless integration and management of stock list data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the stock list API.

## <mark style="color:red;">Get Stock Lists</mark>

The stocks of the products are kept in the stock list. Therefore, before defining a stock for a product, if there is no stock list, it is necessary to define a stock list first.

<table data-header-hidden><thead><tr><th width="121.9453125"></th><th width="123.1171875"></th><th width="96.64453125"></th><th width="96.47265625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Default</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td></td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>limit</td><td>integer</td><td>10</td><td>query</td><td>Amount of line items per page that will be returned</td></tr><tr><td>page</td><td>integer</td><td>1</td><td>query</td><td>Page number to return</td></tr></tbody></table>

**Request GET**

This request is used to retrieve stock lists according to page and limit parameters.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `stock_list/`

```python

import requests

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

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

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

```

**Response**

Response contains all stock list data with given parameters. Resource properties are in Python format.

| **Property**   | **Data Type** | **Description**                                                                                 |
| -------------- | ------------- | ----------------------------------------------------------------------------------------------- |
| name           | string        | Name of the stock list                                                                          |
| code           | string        | The list id in ERP. It is necessary when ‘is\_auto\_sync’ is True.                              |
| is\_auto\_sync | string        | Defines whether the list is synchronized with ERP. If True, the list will update automatically. |

“count” shows how many stock lists exist in the system.

“next” shows the next cursor url to retrieve the desired stock lists.

“previous” shows the previous cursor url to retrieve the desired stock lists.

“results” shows every stock list detail.

```json

{
  "count": 20,
  "next": "https://{customer_api_url}/api/i1/stock_list/?page=2",
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "Alpha Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 2,
      "name": "Marketplace Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 3,
      "name": "Warehouse Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 4,
      "name": "E-Shop Stock List",
      "code": "shop112",
      "is_auto_sync": true
    }
  ]
}
```

## <mark style="color:red;">Search Stock List</mark>

The stocks of the products are kept in the stock list. Therefore, before defining stock for a product, if there is no stock list, it is necessary to define a stock list first. After the stock lists are defined, it may be necessary to search the stock lists.

<table data-header-hidden><thead><tr><th width="124.6484375"></th><th width="111.46484375"></th><th width="105.44921875"></th><th width="104.37109375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Default</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td></td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>name</td><td>string</td><td></td><td>query</td><td>Stock list's name</td></tr><tr><td>limit</td><td>integer</td><td>10</td><td>query</td><td>Amount of items per page that will be returned</td></tr><tr><td><code>page</code></td><td>integer</td><td>1</td><td>query</td><td>Page number to return</td></tr></tbody></table>

**Request GET**

This request is used to retrieve stock lists according to page, limit and given filter parameters.

| **Field** | **Description**                                             |
| --------- | ----------------------------------------------------------- |
| name      | Searches “name” field based on the value, case in-sensitive |
| code      | Searches “code” field based on the value, case in-sensitive |

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path: `stock_list/`

```python

import requests

url = "https://{customer_api_url}/api/i1/stock_list/?{field}={value}"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

```

**Response**

Response contains all stock list data with search parameters. Resource properties are in Python format.

| **Property**   | **Data Type** | **Description**                                                                                |
| -------------- | ------------- | ---------------------------------------------------------------------------------------------- |
| name           | string        | Name of the stock list                                                                         |
| code           | string        | The list ID in ERP. It is necessary when \`is\_auto\_sync\` is True                            |
| is\_auto\_sync | boolean       | Defines whether the list is synchronized with ERP. If True, the list will update automatically |

“count” shows how many stock lists exist in the system.

“next” shows the next cursor url to retrieve the desired stock lists.

“previous” shows the previous cursor url to retrieve the desired stock lists.

“results” shows matched stock list’s in detail.

```json

{
  "count": 20,
  "next": "https://{customer_api_url}/api/i1/stock_list/?page=2",
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "Alpha Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 2,
      "name": "Marketplace Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 3,
      "name": "Warehouse Stock List",
      "code": null,
      "is_auto_sync": false
    },
    {
      "id": 4,
      "name": "E-Shop Stock List",
      "code": "shop112",
      "is_auto_sync": true
    }
  ]
}
```

## <mark style="color:red;">Create Stock List</mark>

The stocks of the products are kept in the stock list. Therefore, before defining stock for a product, if there is no stock list, it is necessary to create a stock list first.

<table data-header-hidden><thead><tr><th width="127.48828125"></th><th width="110.83203125"></th><th width="92.75"></th><th width="99.9921875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>YES</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>name</td><td>float</td><td>body</td><td>YES</td><td>List name</td></tr><tr><td>code</td><td>string</td><td>body</td><td>NO</td><td>The list ID in ERP</td></tr><tr><td>is_auto_sync</td><td>id</td><td>body</td><td>NO</td><td>Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP. If it is False, stock creation and updating processes are managed in Omnitron with excel.</td></tr></tbody></table>

**Request POST**

This request is used to create a new stock list according to the given body. “name” and “code” fields are unique.

‘content\_type’ header represents the response type.

‘Authorization’ header is a required header for authentication. You can retrieve api\_token with login.

Path:`v1/stock_list/`

```python

import requests
import json

url = "https://{customer_api_url}/api/v1/stock_list/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
    'name': 'shop_stock_list_v01',
    'code': 'shop_stock_list_v01',
    'is_auto_sync': False
}
```

**Response**

Returns the created stock list data. Successful response status is expected to be HTTP-201 Created.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="150.73046875"></th><th width="118.84765625"></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>pk</td><td>int</td><td>Primary key of the created list</td></tr><tr><td>name</td><td>string</td><td>Name of the created list</td></tr><tr><td>code</td><td>string</td><td>The list ID in ERP</td></tr><tr><td>is_auto_sync</td><td>boolean</td><td>Specifies whether the list will have synchronization with ERP. If the parameter is True, the list will be automatically updated by ERP.</td></tr><tr><td>modified_date</td><td>date</td><td>Last modified date of the stock list</td></tr><tr><td>created_date</td><td>date</td><td>Shows the date when the stock list was created</td></tr></tbody></table>

```json

{
  "pk": 565,
  "name": "shop_stock_list_v01",
  "code": "shop_stock_list_v01",
  "is_auto_sync": false,
  "modified_date": "2021-07-12T15:06:48.122196Z",
  "created_date": "2021-07-12T15:06:48.122171Z"
}
```

If the name field is already defined in Omnitron, there will be a bad request response.

```json
{
  "name": [
       "stock list with this name already exists."
   ]
}
```

The same bad request response is applicable if the code field is already defined in Omnitron.

```json
{
   "code": [
       "stock list with this code already exists."
   ]
}
```


# Product Stock

This article provides comprehensive information and documentation on a set of API methods specifically designed to handle product stocks. By leveraging these methods, users can retrieve, search, and create product stocks, allowing for seamless integration and management of product stock data within the system.

The article includes detailed explanations, parameter descriptions, and usage examples for each API method, empowering developers to effectively utilize the capabilities provided by the product stock API.

### `GET` Product Stock

Product Stock is responsible for keeping track of stock details of the related product within the specified stock list. There might be more than one piece of stock information for a product. Each product and stock list key pair is unique.

**Path:** `/api/i1/product_stock/`

* `content_type` header represents the response type.
* `Authorization` header is required for authentication. The `api_token` can be retrieved upon login.

**Example Request**

This request is used to retrieve all product stock data according to the limit and page parameters.

```python
import requests

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

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

params = {
    'limit': '4',
    'page': '1'
}

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

**Example Response (200 OK)**

Response contains all stock data with given parameters. Response status is expected to be HTTP-200 Successful. Resource properties are in Python format.

| Property                   | Data Type   | Description                                                    |
| -------------------------- | ----------- | -------------------------------------------------------------- |
| id                         | integer     | ID                                                             |
| product\_sku               | string      | Product SKU                                                    |
| stock                      | integer     | Amount of Stock (min: 0, max: 2147483647)                      |
| stock\_list                | pk field    | Stock List Primary Key                                         |
| unit\_type                 | string      | Stocked Quantity Type (qty: Quantity, kg: Kilogram)            |
| sold\_quantity\_unreported | integer     | Unreported Sold Quantity (min: 0, max: 2147483647)             |
| extra\_field               | JSON object | Extra information field for related stock item of the product. |

Additional metadata:

* count: Number of product stocks in the system.
* next: URL for the next page of product stocks.
* previous: URL for the previous page of product stocks.
* results: Array containing product stock details.

```json
{
  "count": 1012,
  "next": "https://{customer_api_url}/api/i1/product_stock/?limit=4&page=2",
  "previous": null,
  "results": [
    {
      "id": 340,
      "product_sku": "1116131001",
      "stock": 100,
      "stock_list": 1,
      "unit_type": "qty",
      "sold_quantity_unreported": 25
      "extra_field": {
        "test":"test"
      }
    }
  ]
}
```

### `POST` Create or Update Stock

This API follows an upsert logic:

* If the stock list already contains the product SKU, the stock will be updated.
* If the product SKU is not in the stock list, a new stock entry is created.

To create or update a product's stock, the `stock_list` ID is required. Refer to this section for obtaining stock list details.

**Path:** `/api/i1/product_stock/`

* `content_type` header represents the response type.
* `Authorization` header is required for authentication. The `api_token` can be retrieved upon login.

**Request Parameters**

| Parameter                  | Data Type   | Default                                                                  | Required | Description                                                    |
| -------------------------- | ----------- | ------------------------------------------------------------------------ | -------- | -------------------------------------------------------------- |
| product\_sku               | string      |                                                                          | Yes      | Product SKU                                                    |
| stock                      | integer     | 0 during creation, no default in update; if not sent, update is skipped. | No       | Stock Amount (min: 0, max: 2147483647)                         |
| stock\_list                | pk field    |                                                                          | Yes      | Stock List Primary Key                                         |
| unit\_type                 | string      | qty                                                                      | No       | Stocked quantity type. (qty: Quantity, kg: Kilogram)           |
| sold\_quantity\_unreported | integer     |                                                                          | No       | Unreported Sold Quantity (min: 0, max: 2147483647)             |
| extra\_field               | JSON object |                                                                          | No       | Extra information field for related stock item of the product. |

**Example Request**

This request is used to create a new product stock according to the given body.

```python
import requests
import json

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

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

data = {
      'product_sku': '1116131001',
      'stock': 500,
      'stock_list': 2,
      'unit_type': 'qty',
      "sold_quantity_unreported": 25
      "extra_field": {
        "test":"test"
      }   
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.text)
```

**Example Response (201 Created)**

A successful response returns HTTP-201 and the created stock details.

```json
{
  "id": 1270,
  "product_sku": "1116131001",
  "stock": 500,
  "stock_list": 2,
  "unit_type": "qty",
  "sold_quantity_unreported": 25
  "extra_field": {
    "test":"test"
  }
}
```


# Order


# Get Orders

Depending on the channel type, Omnitron retrieves and automatically creates new orders. In order to receive all orders in the system, the user must send an HTTP GET request as shown below.

<table data-header-hidden><thead><tr><th width="115.55859375"></th><th width="112.1015625"></th><th width="97.7578125"></th><th width="90.87890625"></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="/omnitron/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></tbody></table>

{% hint style="warning" %}
If limit and page parameters are not sent, response returns 10 orders in the first page by default.
{% endhint %}

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

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

Sample HTTP request to retrieve all orders in the system.

* `content_type` header represents the response type.
* `Authorization` header is required for authentication. You can retrieve `api_token` by logging in.

**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)
}

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

**Example Response**

Shows desired orders. All parameters of an order are described in the table below.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="156.05078125"></th><th width="141.51171875"></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>Order status at the current time. Order statuses are predefined. You can search for the 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. You can look up 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. You can look up 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.You can look up 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. You can look up 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. You can look up 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) \<br>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. You can look up the Order Item section for more information.</td></tr><tr><td>channel</td><td>dict</td><td>Related Channel object. You can look up the Channel section for more information.</td></tr></tbody></table>

* `Count` shows how many orders exist in the system.
* `Next` shows the next cursor 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 for the current page.

```json
{
 "count": 595,
 "next": "https://{customer_api_url}/api/i1/orders/?limit=2&page=2",
 "previous": null,
 "results": [
   {
     "id": 1,
     "number": "1055565228112825",
     "status": "550",
     "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": "450",
     "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/"         
         }
     }
   }
 ]
}         
```


# 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="/omnitron/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;">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/"         
         }
     }
   }
 ]
}
```


# Get Order Detail by Order Number

In order to extract specific order details, the user must know the number field of the order.

<table data-header-hidden><thead><tr><th width="140.08203125"></th><th width="104.6953125"></th><th width="93.78515625"></th><th width="94.69140625"></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="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>{order_number}</td><td>string</td><td>YES</td><td>query</td><td>Order No.</td></tr></tbody></table>

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">Order Detail by Order Number</mark>

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

GET request is used for retrieving order details.

* `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/{order_number}"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response**

Shows desired order with a given number. All parameters of an order are described in the table below. Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="162.8359375"></th><th width="139.109375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</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>Order status code</td></tr><tr><td>date_placed</td><td>string</td><td>Order date</td></tr><tr><td>customer</td><td>dict</td><td>Customer information</td></tr><tr><td>email</td><td>string</td><td>Customer e-mail</td></tr><tr><td>first_name</td><td>string</td><td>Customer name</td></tr><tr><td>last_name</td><td>string</td><td>Customer surname</td></tr><tr><td>phone_number</td><td>string</td><td>Customer phone</td></tr><tr><td>shipping_address</td><td>dict</td><td>Shipping destination address information</td></tr><tr><td>email</td><td>string</td><td>Ship-to party email</td></tr><tr><td>first_name</td><td>string</td><td>Ship-to party name</td></tr><tr><td>last_name</td><td>string</td><td>Ship-to party surname</td></tr><tr><td>phone_number</td><td>string</td><td>Ship-to party phone number</td></tr><tr><td>country</td><td>dict</td><td>Destination country code</td></tr><tr><td>name</td><td>string</td><td>Destination country name</td></tr><tr><td>code</td><td>string</td><td>Destination country code</td></tr><tr><td>city</td><td>dict</td><td>Order's city details</td></tr><tr><td>id</td><td>string</td><td>City ID</td></tr><tr><td>name</td><td>string</td><td>City name</td></tr><tr><td>line</td><td>string</td><td>Address</td></tr><tr><td>title</td><td>string</td><td>Address title</td></tr><tr><td>township</td><td>dict</td><td>Order's township details</td></tr><tr><td>id</td><td>string</td><td>Township ID</td></tr><tr><td>name</td><td>string</td><td>Township name</td></tr><tr><td>district</td><td>dict</td><td>Order's district details</td></tr><tr><td>id</td><td>string</td><td>District ID</td></tr><tr><td>postcode</td><td>string</td><td>District postcode</td></tr><tr><td>notes</td><td>string</td><td>Address notes</td></tr><tr><td>company_name</td><td>string</td><td>Company name</td></tr><tr><td>tax_office</td><td>string</td><td>Tax office</td></tr><tr><td>tax_no</td><td>string</td><td>Tax no</td></tr><tr><td>e_bill_taxpayer</td><td>boolean</td><td>Is E-bill tax payer or not</td></tr><tr><td>billing_address</td><td>dict</td><td>Billing address</td></tr><tr><td>currency</td><td>string</td><td>Unit of currency</td></tr><tr><td>amount</td><td>float</td><td>Amount</td></tr><tr><td>shipping_amount</td><td>float</td><td>Shipping amount</td></tr><tr><td>shipping_tax_rate</td><td>float</td><td>Shipping tax rate</td></tr><tr><td>extra_field</td><td>dict</td><td>Additional informations about order</td></tr><tr><td>payment_option</td><td>string</td><td>Related Payment Option object id. Check for Payment section for more information.</td></tr><tr><td>payment_option_slug</td><td>string</td><td>Related Payment Option object slug property.</td></tr><tr><td>bin_number</td><td>string</td><td>Bin number</td></tr><tr><td>installment</td><td>string</td><td>Related Installment object id. See the Installment section for more information.</td></tr><tr><td>installment_count</td><td>integer</td><td>Installment count</td></tr><tr><td>installment_interest_amount</td><td>string</td><td>Late charges</td></tr><tr><td>cargo_company</td><td>string</td><td>Cargo company</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_archive_url</td><td>string</td><td>E-archive url</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>discount_amount</td><td>float</td><td>Total discount amount for the order</td></tr><tr><td>is_send</td><td>boolean</td><td>Shows if the order has been sent to ERP</td></tr><tr><td>net_shipping_amount</td><td>float</td><td>Net shipping amount. (Shipping amount + Shipping Interest Amount)</td></tr><tr><td>shipping_interest_amount</td><td>float</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>Shows whether it has a gift box</td></tr><tr><td>gift_box_note</td><td>string</td><td>Gift Note</td></tr><tr><td>external_status</td><td>id</td><td>Related Order External Status object id.</td></tr><tr><td>orderitem_set</td><td>array</td><td>List of order items</td></tr><tr><td>id</td><td>string</td><td>Order item ID</td></tr><tr><td>order</td><td>string</td><td>The order of the order item</td></tr><tr><td>product_sku</td><td>string</td><td>Product SKU of order item</td></tr><tr><td>status</td><td>string</td><td>Order status code</td></tr><tr><td>price_currency</td><td>string</td><td>Price currency of the order item</td></tr><tr><td>price</td><td>float</td><td>Price of the order item</td></tr><tr><td>tax_rate</td><td>float</td><td>Tax rate of the order item</td></tr><tr><td>extra_field</td><td>float</td><td>Additional information about the order item</td></tr><tr><td>price_list</td><td>id</td><td>The price list containing the order item</td></tr><tr><td>stock_list</td><td>id</td><td>The stock list containing the order item</td></tr><tr><td>cancel_status</td><td>string</td><td>waiting, confirmation_waiting, confirmed, approved, rejected, waiting_for_payment, manuel_refund_need, completed</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_archive_url</td><td>string</td><td>E-archive url</td></tr><tr><td>installment_interest_amount</td><td>float</td><td>Delay interest of installment</td></tr><tr><td>tracking_number</td><td>string</td><td>Shipping tracking number</td></tr><tr><td>carrier_shipping_code</td><td>string</td><td>Shipping code for cargo integration</td></tr><tr><td>shipping_company</td><td>string</td><td>Shipping company</td></tr><tr><td>shipment_code</td><td>string</td><td>Shipment code</td></tr><tr><td>external_status</td><td>id</td><td>Related Order External Status object ID.</td></tr><tr><td>discount_amount</td><td>string</td><td>Total discount applied of order</td></tr><tr><td>retail_price</td><td>float</td><td>Retail price</td></tr><tr><td>attributes</td><td>dict</td><td>Attribute list</td></tr><tr><td>attributes_kwargs</td><td>dict</td><td>Details of the attributes attached to the product</td></tr><tr><td>image</td><td>str(url)</td><td>Product image</td></tr></tbody></table>

```json
{
    "id": 27,
    "number": "bf7b66149236455",
    "status": "400",
    "date_placed": "2017-01-30T08:28:26.158165Z",
    "customer": {
        "id": 1103,
        "email": "test@test.com",
        "first_name": "TEST",
        "last_name": "TEST",
        "phone_number": null
    },
    "shipping_address": {
        "email": "test@test.com",
        "phone_number": "0 (198) 895-4431",
        "first_name": "TEST",
        "last_name": "TEST",
        "country": {
            "name": "Turkey",
            "code": "tr"
        },
        "city": {
            "id": 71,
            "name": "Afyon"
        },
        "line": "test",
        "title": "TEST",
        "township": {
            "id": 853,
            "name": "DİNAR"
        },
        "district": {
            "id": 3679,
            "name": "İNCESU"
        },
        "postcode": "11111",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "identity_number": null,
        "extra_field": {}
    },
    "billing_address": {
        "email": "test@test.com",
        "phone_number": "0 (198) 895-4431",
        "first_name": "TEST",
        "last_name": "TEST",
        "country": {
            "name": "Turkey",
            "code": "tr"
        },
        "city": {
            "id": 71,
            "name": "Afyon"
        },
        "line": "test",
        "title": "TEST",
        "township": {
            "id": 853,
            "name": "DİNAR"
        },
        "district": {
            "id": 3679,
            "name": "İNCESU"
        },
        "postcode": "11111",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "identity_number": null,
        "extra_field": {}
    },
    "currency": "try",
    "amount": "16.40",
    "shipping_amount": "8.50",
    "shipping_tax_rate": null,
    "extra_field": {
        "cargo_line_id": "325a79ac-e251-4285-8a32-a70e0119237e"
    },
    "payment_option": 2,
    "payment_option_slug": "kredi_karti",
    "bin_number": "454360",
    "installment": 22,
    "installment_count": 1,
    "installment_interest_amount": "0.00",
    "cargo_company": 1,
    "invoice_number": "",
    "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": "8.50",
    "shipping_interest_amount": "0.00",
    "tracking_number": null,
    "carrier_shipping_code": null,
    "remote_addr": null,
    "has_gift_box": false,
    "gift_box_note": null,
    "external_status": null,
    "orderitem_set": [
        {
            "id": 113,
            "order": 27,
            "product_sku": "2672881047887",
            "status": "400",
            "price_currency": "try",
            "price": "7.90",
            "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": null,
            "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": "http://localhost:8080/api/v1/"
        }
    }
}
```


# Get Order Item Detail

Unlike the `api/i1/orders` endpoint, it shows the most detailed version of both the order and the products in the order. In order to extract detailed data, the user needs to know the ID of the order item or the ID of the order.

<table data-header-hidden><thead><tr><th width="147.78515625"></th><th width="114.703125"></th><th width="89.49609375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>{orderitem_id}</td><td>string</td><td>query</td><td>Order Item ID. This information can be obtained from the Order Detail service</td></tr><tr><td>{order_id}</td><td>string</td><td>query</td><td>Order Item ID. This information can be obtained from the Order Detail service</td></tr></tbody></table>

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">All Order Items within an Order</mark>

**Path:** `/api/i1/order_item/detailed_integration/?order={order_id}`

Sample HTTP request to extract every order item information within an order. The user must send `order_id` in `query_param`.

* `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/v1/order_item//detailed_integration/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
   'content-type': 'application/json',
   'Authorization': 'Token {}'.format(api_token)
}
Params = {
   'order': 123 # order id
}

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

**Example Response**

Expected response status code is 200-Successful. Every property detail is described in the table below.

**Order Item**

<table data-header-hidden><thead><tr><th width="179.09375"></th><th width="141.4921875"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>pk</td><td>integer</td><td>order item's primary key</td></tr><tr><td>primary key of</td><td>order</td><td>integer</td></tr><tr><td>product</td><td>dict</td><td>full detail of the product</td></tr><tr><td>status</td><td>enum</td><td>order item status (same enum list as order's status)</td></tr><tr><td>price_currency</td><td>enum</td><td>currency information</td></tr><tr><td>price</td><td>decimal</td><td>order item's price</td></tr><tr><td>tax_rate</td><td>decimal</td><td>tax rate</td></tr><tr><td>price_list</td><td>dict</td><td>details of price list</td></tr><tr><td>stock_list</td><td>dict</td><td>stock list detail info</td></tr><tr><td>invoice_number</td><td>text</td><td>invoice number</td></tr><tr><td>e_archive_url</td><td>text</td><td>e-archive invoice url</td></tr><tr><td>cancel_status</td><td>enum</td><td>cancel status (waiting/rejected/completed)</td></tr><tr><td>status_display</td><td>text</td><td>corresponding to the information in the status key</td></tr><tr><td>installment_interest_amount</td><td>decimal</td><td>interest amount</td></tr><tr><td>net_amount</td><td>decimal</td><td>net amount with discounts deducted, interest added</td></tr><tr><td>tracking_number</td><td>text</td><td>shipment tracking number</td></tr><tr><td>shipping_company</td><td>enum</td><td>shipping company info</td></tr><tr><td>discount_amount</td><td>decimal</td><td>discount amount</td></tr><tr><td>benefitapplicant_set</td><td>dict</td><td>discount items applied to order item</td></tr><tr><td>external_status</td><td>text</td><td>optional, external status</td></tr><tr><td>retail_price</td><td>decimal</td><td>store price</td></tr><tr><td>tracking_url</td><td>text</td><td>tracking url</td></tr><tr><td>mapping</td><td>dict</td><td>optional, mapping</td></tr></tbody></table>

**Benefit Applicant Set**

Represents relevant Benefit Applicant model information. Order Item has multiple relationships. The Benefit Applicant maintains the discounted item models and discount sharing information for the relevant order items.

<table data-header-hidden><thead><tr><th width="178.640625"></th><th width="147.2578125"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>id</td><td>integer</td><td>benefits applicant ID</td></tr><tr><td>created_date</td><td>date</td><td>created date</td></tr><tr><td>modified_date</td><td>date</td><td>modified date</td></tr><tr><td>discount_share</td><td>decimal</td><td>discount amount applied to order item</td></tr><tr><td>discount_item</td><td>integer</td><td>discount item ID</td></tr><tr><td>order_item</td><td>integer</td><td>order item ID</td></tr></tbody></table>

```json
{
    "count": 4,
    "next": null,
    "previous": null,
    "results": [
        {
            "pk": 123,
            "order": 37,
            "product": {
                "pk": 845,
                "name": "Quınn 6-Lı Bardak Seti300 Ml",
                "base_code": "1KBARD0243",
                "sku": "2672881093877",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt06Desc": "300 ML",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "uretim_yeri": "ÇEK CUMHURİYETİ",
                    "renk": "STD",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "STD",
                    "erp_ProductAtt18Desc": "KRİSTAL",
                    "materyal": "CAM",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductHierarchyLevel02": "Cam",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt02Desc": "Su/Meşrubat Bardağı",
                    "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "integration_ProductAtt18Desc": "KRİSTAL",
                    "erp_ProductAtt20Desc": "CAM",
                    "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "erp_ProductCode": "1KBARD0243139",
                    "integration_ProductAtt13Desc": "Dekoratif - %50+%50",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "boyut": "300 ML",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductAtt13Desc": "Dekoratif - %50+%50",
                    "integration_ProductCode": "1KBARD0243139",
                    "integration_ProductAtt07Desc": "50+50 promosyon",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Cam",
                    "erp_ProductAtt25Desc": "ÇEK CUMHURİYETİ",
                    "integration_ProductAtt02Desc": "Su/Meşrubat Bardağı"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Cam",
                        "data_type": "dropdown",
                        "label": "Cam"
                    },
                    "renk": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "erp_color": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Cam",
                        "data_type": "dropdown",
                        "label": "Cam"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 15114,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/845/79d3df28-b32c-4f60-affd-0b2930542ee8.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:23:27.051963Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.509172Z"
                    }
                ],
                "attribute_set": 30,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:51:25.285322Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:46:20.026952Z",
                "uuid": "32cd81fe-71ee-4740-a6b9-63bfaf105dea",
                "created_date": "2017-01-22T21:59:37.223013Z"
            },
            "status": "400",
            "price_currency": "try",
            "price": "63.92",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": null,
            "status_display": "approved",
            "installment_interest_amount": "0.00",
            "net_amount": "63.92",
            "tracking_number": null,
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null,
            "mapping": [
                {
                    "pk": 965,
                    "content_type": 44,
                    "object_id": 123,
                    "integration_type": "external_company",
                    "code": "6edc7de5-8762-448f-9b36-a71200956cfc",
                    "modified_date": "2017-02-06T09:04:02.347739Z",
                    "created_date": "2017-02-06T09:04:02.347715Z"
                }
            ]
        },
        {
            "pk": 124,
            "order": 37,
            "product": {
                "pk": 845,
                "name": "Quınn 6-Lı Bardak Seti300 Ml",
                "base_code": "1KBARD0243",
                "sku": "2672881093877",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt06Desc": "300 ML",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "uretim_yeri": "ÇEK CUMHURİYETİ",
                    "renk": "STD",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "STD",
                    "erp_ProductAtt18Desc": "KRİSTAL",
                    "materyal": "CAM",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductHierarchyLevel02": "Cam",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt02Desc": "Su/Meşrubat Bardağı",
                    "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "integration_ProductAtt18Desc": "KRİSTAL",
                    "erp_ProductAtt20Desc": "CAM",
                    "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "erp_ProductCode": "1KBARD0243139",
                    "integration_ProductAtt13Desc": "Dekoratif - %50+%50",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "boyut": "300 ML",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductAtt13Desc": "Dekoratif - %50+%50",
                    "integration_ProductCode": "1KBARD0243139",
                    "integration_ProductAtt07Desc": "50+50 promosyon",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Cam",
                    "erp_ProductAtt25Desc": "ÇEK CUMHURİYETİ",
                    "integration_ProductAtt02Desc": "Su/Meşrubat Bardağı"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Cam",
                        "data_type": "dropdown",
                        "label": "Cam"
                    },
                    "renk": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "erp_color": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Cam",
                        "data_type": "dropdown",
                        "label": "Cam"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 15114,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/845/79d3df28-b32c-4f60-affd-0b2930542ee8.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:23:27.051963Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.509172Z"
                    }
                ],
                "attribute_set": 30,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:51:25.285322Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:46:20.026952Z",
                "uuid": "32cd81fe-71ee-4740-a6b9-63bfaf105dea",
                "created_date": "2017-01-22T21:59:37.223013Z"
            },
            "status": "400",
            "price_currency": "try",
            "price": "63.92",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": null,
            "status_display": "approved",
            "installment_interest_amount": "0.00",
            "net_amount": "63.92",
            "tracking_number": null,
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null,
            "mapping": [
                {
                    "pk": 966,
                    "content_type": 44,
                    "object_id": 124,
                    "integration_type": "external_company",
                    "code": "6edc7de5-8762-448f-9b36-a71200956cfc",
                    "modified_date": "2017-02-06T09:04:02.408986Z",
                    "created_date": "2017-02-06T09:04:02.408960Z"
                }
            ]
        },
        {
            "pk": 125,
            "order": 37,
            "product": {
                "pk": 8606,
                "name": "Pot N2747003604071910",
                "base_code": "1KSURH0090",
                "sku": "2672880307807",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt15Desc": "%50+%20 PROMOSYON",
                    "erp_ProductCode": "1KSURH0090139",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "uretim_yeri": "ÇİN",
                    "renk": "STD",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "STD",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "integration_ProductCode": "1KSURH0090139",
                    "integration_ProductAtt14Desc": "SERAMİK SÜRAHİ 25 CM.",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductAtt14Desc": "SERAMİK SÜRAHİ 25 CM.",
                    "erp_ProductHierarchyLevel02": "Porselen",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt02Desc": "Mutfak - Saklama Kabı",
                    "integration_ProductAtt15Desc": "%50+%20 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Porselen",
                    "erp_ProductAtt25Desc": "ÇİN",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "integration_ProductAtt02Desc": "Mutfak - Saklama Kabı",
                    "integration_ProductAtt07Desc": "50+50 promosyon"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Porselen",
                        "data_type": "dropdown",
                        "label": "Porselen"
                    },
                    "renk": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "erp_color": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Porselen",
                        "data_type": "dropdown",
                        "label": "Porselen"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 11568,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/8606/6f8f886b-dbc9-4d06-8539-86a08b16b2fe.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T08:53:11.923793Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:56.938022Z"
                    },
                    {
                        "pk": 11569,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/8606/4052ce54-0876-491e-9cf6-7672274f7c14.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T08:53:11.983128Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:56.938022Z"
                    }
                ],
                "attribute_set": 32,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:10:22.856627Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:47:04.786012Z",
                "uuid": "ea4e0ef1-7d4c-4ee4-a68d-9e33bea2aa20",
                "created_date": "2017-01-22T22:31:39.053320Z"
            },
            "status": "400",
            "price_currency": "try",
            "price": "24.72",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": null,
            "status_display": "approved",
            "installment_interest_amount": "0.00",
            "net_amount": "24.72",
            "tracking_number": null,
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null,
            "mapping": [
                {
                    "pk": 963,
                    "content_type": 44,
                    "object_id": 125,
                    "integration_type": "external_company",
                    "code": "e9630cd5-4b0c-44da-8965-a71200956cc5",
                    "modified_date": "2017-02-06T09:04:02.232395Z",
                    "created_date": "2017-02-06T09:04:02.232367Z"
                }
            ]
        },
        {
            "pk": 126,
            "order": 37,
            "product": {
                "pk": 8606,
                "name": "Pot N2747003604071910",
                "base_code": "1KSURH0090",
                "sku": "2672880307807",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt15Desc": "%50+%20 PROMOSYON",
                    "erp_ProductCode": "1KSURH0090139",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "uretim_yeri": "ÇİN",
                    "renk": "STD",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "STD",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "integration_ProductCode": "1KSURH0090139",
                    "integration_ProductAtt14Desc": "SERAMİK SÜRAHİ 25 CM.",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductAtt14Desc": "SERAMİK SÜRAHİ 25 CM.",
                    "erp_ProductHierarchyLevel02": "Porselen",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt02Desc": "Mutfak - Saklama Kabı",
                    "integration_ProductAtt15Desc": "%50+%20 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Porselen",
                    "erp_ProductAtt25Desc": "ÇİN",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "integration_ProductAtt02Desc": "Mutfak - Saklama Kabı",
                    "integration_ProductAtt07Desc": "50+50 promosyon"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Porselen",
                        "data_type": "dropdown",
                        "label": "Porselen"
                    },
                    "renk": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "erp_color": {
                        "value": "STD",
                        "data_type": "dropdown",
                        "label": "STD"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Porselen",
                        "data_type": "dropdown",
                        "label": "Porselen"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 11568,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/8606/6f8f886b-dbc9-4d06-8539-86a08b16b2fe.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T08:53:11.923793Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:56.938022Z"
                    },
                    {
                        "pk": 11569,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/8606/4052ce54-0876-491e-9cf6-7672274f7c14.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T08:53:11.983128Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:56.938022Z"
                    }
                ],
                "attribute_set": 32,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:10:22.856627Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:47:04.786012Z",
                "uuid": "ea4e0ef1-7d4c-4ee4-a68d-9e33bea2aa20",
                "created_date": "2017-01-22T22:31:39.053320Z"
            },
            "status": "400",
            "price_currency": "try",
            "price": "24.72",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": null,
            "status_display": "approved",
            "installment_interest_amount": "0.00",
            "net_amount": "24.72",
            "tracking_number": null,
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null,
            "mapping": [
                {
                    "pk": 964,
                    "content_type": 44,
                    "object_id": 126,
                    "integration_type": "external_company",
                    "code": "e9630cd5-4b0c-44da-8965-a71200956cc5",
                    "modified_date": "2017-02-06T09:04:02.292737Z",
                    "created_date": "2017-02-06T09:04:02.292711Z"
                }
            ]
        }
    ]
}

```

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">Order Item - Single</mark>

**Path:** `/api/i1/order_item/{orderitem_id}/detailed_integration/`

Sample HTTP request to extract single order item information. The user must send `order_item_id.` in query.

* `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/v1/order_item/{orderitem_id}/detailed_integration/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response**

Expected response status code is 200-Successful. Every property detail is described in the table below.

**Order Item**

<table data-header-hidden><thead><tr><th width="174.44140625"></th><th width="149.46484375"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>pk</td><td>integer</td><td>order item's primary key</td></tr><tr><td>primary key of</td><td>order</td><td>integer</td></tr><tr><td>product</td><td>dict</td><td>full detail of the product</td></tr><tr><td>status</td><td>enum</td><td>order item status (same enum list as order's status)</td></tr><tr><td>price_currency</td><td>enum</td><td>currency information</td></tr><tr><td>price</td><td>decimal</td><td>order item's price</td></tr><tr><td>tax_rate</td><td>decimal</td><td>tax rate</td></tr><tr><td>price_list</td><td>dict</td><td>details of price list</td></tr><tr><td>stock_list</td><td>dict</td><td>stock list detail info</td></tr><tr><td>invoice_number</td><td>text</td><td>invoice number</td></tr><tr><td>e_archive_url</td><td>text</td><td>e archive invoice url</td></tr><tr><td>cancel_status</td><td>enum</td><td>cancel status (waiting/rejected/completed)</td></tr><tr><td>status_display</td><td>text</td><td>corresponding to the information in the status key</td></tr><tr><td>installment_interest_amount</td><td>decimal</td><td>interest amount</td></tr><tr><td>net_amount</td><td>decimal</td><td>net amount with discounts deducted, interest added</td></tr><tr><td>tracking_number</td><td>text</td><td>shipment tracking number</td></tr><tr><td>shipping_company</td><td>enum</td><td>shipping company info</td></tr><tr><td>discount_amount</td><td>decimal</td><td>discount amount</td></tr><tr><td>benefitapplicant_set</td><td>dict</td><td>discount items applied to order item</td></tr><tr><td>external_status</td><td>text</td><td>optional, external status</td></tr><tr><td>retail_price</td><td>decimal</td><td>store price</td></tr><tr><td>tracking_url</td><td>text</td><td>tracking url</td></tr><tr><td>mapping</td><td>dict</td><td>optional, mapping</td></tr></tbody></table>

**Benefit Applicant Set**

Represents relevant Benefit Applicant model information. Order Item has multiple relationships. The Benefit Applicant maintains the discounted item models and discount sharing information for the relevant order items.

<table data-header-hidden><thead><tr><th width="171.8046875"></th><th width="168.97265625"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>id</td><td>integer</td><td>benefits applicant ID</td></tr><tr><td>created_date</td><td>date</td><td>created date</td></tr><tr><td>modified_date</td><td>date</td><td>modified date</td></tr><tr><td>discount_share</td><td>decimal</td><td>discount amount applied to order item</td></tr><tr><td>discount_item</td><td>integer</td><td>discount item ID</td></tr><tr><td>order_item</td><td>integer</td><td>order item ID</td></tr></tbody></table>

```json
{
    "pk": 123,
    "order": 37,
    "product": {
        "pk": 845,
        "name": "Quınn 6-Lı Bardak Seti300 Ml",
        "base_code": "1KBARD0243",
        "sku": "2672881093877",
        "product_type": "0",
        "is_active": true,
        "parent": null,
        "attributes": {
            "erp_ProductAtt06Desc": "300 ML",
            "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
            "uretim_yeri": "ÇEK CUMHURİYETİ",
            "renk": "STD",
            "integration_ProductAtt03Desc": "2011/2012 KIŞ",
            "erp_ProductAtt07Desc": "50+50 promosyon",
            "erp_color": "STD",
            "erp_ProductAtt18Desc": "KRİSTAL",
            "materyal": "CAM",
            "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
            "erp_ProductHierarchyLevel02": "Cam",
            "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
            "erp_ProductAtt02Desc": "Su/Meşrubat Bardağı",
            "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
            "integration_ProductAtt18Desc": "KRİSTAL",
            "erp_ProductAtt20Desc": "CAM",
            "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
            "erp_ProductCode": "1KBARD0243139",
            "integration_ProductAtt13Desc": "Dekoratif - %50+%50",
            "integration_ProductAtt01Desc": "DIŞ ALIM",
            "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
            "boyut": "300 ML",
            "erp_ProductAtt01Desc": "DIŞ ALIM",
            "erp_ProductAtt13Desc": "Dekoratif - %50+%50",
            "integration_ProductCode": "1KBARD0243139",
            "integration_ProductAtt07Desc": "50+50 promosyon",
            "erp_ProductAtt03Desc": "2011/2012 KIŞ",
            "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
            "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
            "integration_ProductHierarchyLevel02": "Cam",
            "erp_ProductAtt25Desc": "ÇEK CUMHURİYETİ",
            "integration_ProductAtt02Desc": "Su/Meşrubat Bardağı"
        },
        "attributes_kwargs": {
            "erp_ProductHierarchyLevel01": {
                "value": "TEKSTİL DIŞI",
                "data_type": "dropdown",
                "label": "TEKSTİL DIŞI"
            },
            "erp_ProductHierarchyLevel02": {
                "value": "Cam",
                "data_type": "dropdown",
                "label": "Cam"
            },
            "renk": {
                "value": "STD",
                "data_type": "dropdown",
                "label": "STD"
            },
            "erp_color": {
                "value": "STD",
                "data_type": "dropdown",
                "label": "STD"
            },
            "integration_ProductHierarchyLevel01": {
                "value": "TEKSTİL DIŞI",
                "data_type": "dropdown",
                "label": "TEKSTİL DIŞI"
            },
            "integration_ProductHierarchyLevel02": {
                "value": "Cam",
                "data_type": "dropdown",
                "label": "Cam"
            }
        },
        "extra_attributes": {},
        "group_products": [],
        "productimage_set": [
            {
                "pk": 15114,
                "status": "active",
                "image": "http://localhost:8000/media/products/2017/01/23/845/79d3df28-b32c-4f60-affd-0b2930542ee8.jpg",
                "order": 0,
                "created_date": "2017-01-23T15:23:27.051963Z",
                "specialimage_set": [],
                "modified_date": "2021-11-03T10:04:57.509172Z"
            }
        ],
        "attribute_set": 30,
        "custom_attribute_set": null,
        "productization_date": "2017-01-23T17:51:25.285322Z",
        "listing_code": null,
        "data_source": null,
        "modified_date": "2021-02-23T13:46:20.026952Z",
        "uuid": "32cd81fe-71ee-4740-a6b9-63bfaf105dea",
        "created_date": "2017-01-22T21:59:37.223013Z"
    },
    "status": "400",
    "price_currency": "try",
    "price": "63.92",
    "tax_rate": "18.00",
    "extra_field": {},
    "price_list": {
        "pk": 1,
        "name": "default_price_list",
        "code": "default_price_list",
        "is_auto_sync": true,
        "modified_date": "2017-01-22T12:14:44.637000Z",
        "created_date": "2017-01-22T12:14:44.637000Z",
        "currency": "try"
    },
    "stock_list": {
        "pk": 1,
        "name": "default_stock_list",
        "code": "default_stock_list",
        "is_auto_sync": true,
        "modified_date": "2017-01-22T12:14:18.030000Z",
        "created_date": "2017-01-22T12:14:18.030000Z"
    },
    "invoice_number": null,
    "invoice_date": null,
    "e_archive_url": null,
    "cancel_status": null,
    "status_display": "approved",
    "installment_interest_amount": "0.00",
    "net_amount": "63.92",
    "tracking_number": null,
    "shipping_company": null,
    "discount_amount": "0.00",
    "shipment_code": null,
    "benefitapplicant_set": [],
    "external_status": null,
    "retail_price": null,
    "attributes": {},
    "attributes_kwargs": {},
    "tracking_url": null,
    "image": null,
    "parent": null,
    "data_source": null,
    "estimated_delivery_date": null,
    "datasource": null,
    "mapping": [
        {
            "pk": 965,
            "content_type": 44,
            "object_id": 123,
            "integration_type": "external_company",
            "code": "6edc7de5-8762-448f-9b36-a71200956cfc",
            "modified_date": "2017-02-06T09:04:02.347739Z",
            "created_date": "2017-02-06T09:04:02.347715Z"
        }
    ]
}
```


# Orders ID Detail Integration

Shows the detailed version of the order. The endpoint `api/v1/order_item/detailed_integration/?order={order_pk}.` can be used for both the order and the order items under the order.

With this endpoint the user can extract every relation information with a given order ID.

| **Parameter** | **Data Type** | **In** | **Description**                                                    |
| ------------- | ------------- | ------ | ------------------------------------------------------------------ |
| api\_token    | string        | header | [The API key of the customer’s account](/omnitron/getting-started) |
| {order\_id}   | string        | query  | Order ID                                                           |

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

**Path:** `/api/i1/orders_integration/{order_id}/detailed_integration/`

Sample HTTP request for extracting every relation detail for the given order ID.

* `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/v1/orders_integration/{order_id}/detailed_integration/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response**

Shows desired order properties. All parameters of an order are described in the table below.

**Order**

<table data-header-hidden><thead><tr><th width="204.0546875"></th><th width="139.80078125"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>pk</td><td>integer</td><td>order's pk</td></tr><tr><td>number</td><td>text</td><td>order's number</td></tr><tr><td>channel</td><td>dict</td><td>channel information the order came from</td></tr><tr><td>status</td><td>enum</td><td>order status</td></tr><tr><td>date_placed</td><td>date</td><td>order creation date</td></tr><tr><td>customer</td><td>dict</td><td>customer info</td></tr><tr><td>shipping_address</td><td>dict</td><td>address info</td></tr><tr><td>billing_address</td><td>dict</td><td>billing address information</td></tr><tr><td>currency</td><td>enum</td><td>currency information</td></tr><tr><td>amount</td><td>decimal</td><td>order amount</td></tr><tr><td>shipping_amount</td><td>decimal</td><td>shipping rate</td></tr><tr><td>shipping_tax_rate</td><td>decimal</td><td>tax rate of shipping</td></tr><tr><td>extra_field</td><td>dict</td><td>optional</td></tr><tr><td>transaction_set</td><td>dict</td><td>transaction information for credit card orders</td></tr><tr><td>payment_option</td><td>dict</td><td>payment option info</td></tr><tr><td>payment_option_slug</td><td>text</td><td>payment option slug info</td></tr><tr><td>bin_number</td><td>text</td><td>bin number for credit card orders</td></tr><tr><td>installment</td><td>dict</td><td>installation info</td></tr><tr><td>installment_count</td><td>integer</td><td>information how many installments the order was taken</td></tr><tr><td>installment_interest_amount</td><td>decimal</td><td>interest amount</td></tr><tr><td>cargo_company</td><td>dict</td><td>The shipping company chosen by the customer for the order</td></tr><tr><td>invoice_number</td><td>text</td><td>invoice info</td></tr><tr><td>e_archive_url</td><td>text</td><td>e archive url info</td></tr><tr><td>refund_amount</td><td>decimal</td><td>refund amount (if any)</td></tr><tr><td>discount_refund_amount</td><td>decimal</td><td>discount refund amount (if any)</td></tr><tr><td>shipping_refund_amount</td><td>decimal</td><td>shipping refund amount (if any)</td></tr><tr><td>discount_amount</td><td>decimal</td><td>discount amount (if any)</td></tr><tr><td>cancellation_info</td><td>dict</td><td>Holds cancellation information. After cancellation proceeds this dict will be cleaned.</td></tr><tr><td>status_display</td><td>text</td><td>status description</td></tr><tr><td>tracking_number</td><td>text</td><td>shipment tracking number</td></tr><tr><td>is_send</td><td>bool</td><td>flag whether the order is reported to erp</td></tr><tr><td>cancel_status</td><td>enum</td><td>(waiting/completed/rejected)</td></tr><tr><td>net_shipping_amount</td><td>decimal</td><td>deducted shipping amount</td></tr><tr><td>remote_addr</td><td>ip address</td><td>ordering ip address</td></tr><tr><td>language_code</td><td>enum</td><td>language of the user who placed the order</td></tr><tr><td>fundstransfertransaction_set</td><td>dict</td><td>transfer order transaction information</td></tr><tr><td>has_gift_box</td><td>bool</td><td>gift wrap (yes/no)</td></tr><tr><td>gift_box_note</td><td>text</td><td>gift note</td></tr><tr><td>external_status</td><td>text</td><td>external status</td></tr><tr><td>payondeliverytransaction_set</td><td>dict</td><td>delivery transaction information</td></tr><tr><td>loyaltytransaction_set</td><td>dict</td><td>loyalty card payment transaction information</td></tr><tr><td>bextransaction_set</td><td>dict</td><td>bex transactions of the order</td></tr><tr><td>cashregistertransaction_set</td><td>dict</td><td>cash register transactions of the order</td></tr><tr><td>cancellationplan_set</td><td>dict</td><td>cancellation/refund (cancellation plan) information</td></tr><tr><td>client_type</td><td>enum</td><td>Shows the client platform. Client types are predefined. Choices are default, ios, android and instore.</td></tr><tr><td>shipping_interest_amount</td><td>decimal</td><td>shipping interest amount of the order</td></tr><tr><td>mapping</td><td>dict</td><td>optional</td></tr><tr><td>ordertransaction_set</td><td>dict</td><td>transaction of the order</td></tr><tr><td>ordershippinginfo_set</td><td>dict</td><td>order delivery detail</td></tr></tbody></table>

**Installment**

It keeps the information of how many installments the order has and the interest amount. Installment properties are listed below.

| **Key**            | **Value** | **Description**                                            |
| ------------------ | --------- | ---------------------------------------------------------- |
| pk                 | integer   | ID of the object                                           |
| card               | dict      | Related Card object. See the Payment section for more info |
| installment\_count | integer   | number of installments                                     |
| label              | text      | installment statement                                      |
| interest\_rate     | decimal   | interest rate                                              |

**Cargo Company**

It keeps the cargo company information. Cargo company properties are listed below.

| **Key**           | **Value** | **Description**                                          |
| ----------------- | --------- | -------------------------------------------------------- |
| pk                | integer   | ID of the object                                         |
| name              | text      | name of shipping company                                 |
| erp\_code         | text      | shipping company code                                    |
| shipping\_company | enum      | The shipping company to which the seller sent the order. |

**Transaction Set**

It keeps the related `pre_purchase`, purchase and refund transactions information. Transaction properties are listed below.

| **Key**           | **Value**  | **Description**                                 |
| ----------------- | ---------- | ----------------------------------------------- |
| pk                | integer    | transaction ID                                  |
| transaction\_type | enum       | transaction type (purchase/refund)              |
| transaction\_id   | text       | unique transaction identifier                   |
| auth\_code        | text       | authentication code for related payment gateway |
| pos               | dict       | holds related Pos object properties             |
| main\_pos         | dict       | holds related main Pos object properties        |
| order             | dict       | keeps related order object properties           |
| user\_email       | text       | email of the user                               |
| raw\_request      | text       | request to the bank                             |
| raw\_response     | text       | response from bank                              |
| is\_succeeded     | bool       | information about successful transaction        |
| amount            | decimal    | the amount withdrawn in this transaction        |
| remote\_addr      | ip address | operating IP                                    |
| created\_date     | date       | created date                                    |
| pos\_slug         | text       | pos slug in Omnitron                            |

**Address Set**

Billing or shipping address information. It keeps the related address model properties details.

| **Key**           | **Value** | **Description**            |
| ----------------- | --------- | -------------------------- |
| pk                | integer   | ID of the address object   |
| email             | text      | email address for shipping |
| phone\_number     | text      | phone number               |
| first\_name       | text      | name                       |
| last\_name        | text      | surname                    |
| country           | dict      | country info               |
| city              | dict      | city info                  |
| township          | dict      | town information           |
| district          | dict      | neighborhood info          |
| line              | text      | address directions         |
| title             | text      | address title              |
| postcode          | text      | postcode                   |
| tax\_office       | text      | tax office                 |
| tax\_no           | text      | tax/tck no                 |
| e\_bill\_taxpayer | bool      | e-invoice payer            |
| company\_name     | text      | company name               |
| address\_type     | enum      | customer/company           |

**Order Shipping Info Set**

It keeps the related cargo integration information.

| **Key**           | **Value** | **Description**                                                               |
| ----------------- | --------- | ----------------------------------------------------------------------------- |
| pk                | integer   | object primary key                                                            |
| order             | integer   | order primary key                                                             |
| order\_number     | text      | order's number in the Omnitron                                                |
| shipping\_company | enum      | the shipping company to which the seller sent the order                       |
| send\_request     | text      | in case the Omnitron writes to the cargo, the request is made by the Omnitron |
| send\_response    | text/json | response from omnitron                                                        |
| is\_send          | boolean   | states of whether shipping was successful                                     |
| cargo\_label      | text      | label getting from cargo integration                                          |

```json
         {
    "pk": 27,
    "number": "bf7b66149236455",
    "channel": {
        "pk": 1,
        "name": "Shop",
        "channel_type": "web",
        "catalog": 1,
        "modified_date": "2022-06-13T10:47:45.640791Z",
        "created_date": "2017-01-22T23:33:29.178976Z",
        "category_tree": null,
        "is_active": true,
        "conf": {
            "username": "Hasan",
            "feature_flags": {},
            "auth_token": "AILeoZiTaWGHEIHSvfdaaURqFBEWgbhdNrlxShtu",
            "server": "http://localhost:8080/api/v1/",
            "localized_cancel_mail_subject": {},
            "sales_url": "http://www.madamecoco.com",
            "password": "Password123!"
        },
        "schema": {}
    },
    "status": "400",
    "date_placed": "2017-01-30T08:28:26.158165Z",
    "customer": {
        "pk": 1103,
        "channel": 1,
        "email": "test@test.com",
        "first_name": "TEST",
        "last_name": "TEST",
        "phone_number": null,
        "is_active": true,
        "channel_code": "7",
        "erp_code": "760906",
        "extra_field": {},
        "modified_date": "2017-02-05T19:22:01.340598Z",
        "created_date": "2017-02-02T09:40:28.855012Z",
        "date_joined": "2017-01-30T08:21:20.657225Z",
        "email_allowed": false,
        "sms_allowed": false,
        "call_allowed": false,
        "gender": null,
        "attributes": {},
        "user_type": null,
        "date_of_birth": null
    },
    "shipping_address": {
        "pk": 27,
        "email": "test@test.com",
        "phone_number": "0 (198) 895-4431",
        "first_name": "TEST",
        "last_name": "TEST",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z",
            "mapping": [
                {
                    "pk": 1,
                    "content_type": 33,
                    "object_id": 1,
                    "integration_type": "external_company",
                    "code": "TR",
                    "modified_date": "2017-01-24T10:58:56.765596Z",
                    "created_date": "2017-01-24T10:58:56.765567Z"
                }
            ]
        },
        "city": {
            "pk": 71,
            "is_active": true,
            "name": "Afyon",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.270000Z",
            "created_date": "2016-12-22T08:50:57.270000Z",
            "mapping": [
                {
                    "pk": 25,
                    "content_type": 36,
                    "object_id": 71,
                    "integration_type": "external_company",
                    "code": "TR.03",
                    "modified_date": "2017-01-24T10:58:58.771769Z",
                    "created_date": "2017-01-24T10:58:58.771729Z"
                }
            ]
        },
        "line": "test",
        "title": "TEST",
        "township": {
            "pk": 853,
            "is_active": true,
            "name": "DİNAR",
            "city": 71,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:20.112000Z",
            "created_date": "2016-12-22T08:51:20.111000Z",
            "mapping": [
                {
                    "pk": 28,
                    "content_type": 34,
                    "object_id": 853,
                    "integration_type": "external_company",
                    "code": "TR.00304",
                    "modified_date": "2017-01-24T10:58:59.087915Z",
                    "created_date": "2017-01-24T10:58:59.087889Z"
                }
            ]
        },
        "district": {
            "pk": 3679,
            "is_active": true,
            "name": "İNCESU",
            "city": 71,
            "township": 853,
            "postcode": null,
            "zipcode": null,
            "modified_date": "2016-12-22T08:53:12.031000Z",
            "created_date": "2016-12-22T08:53:12.031000Z",
            "mapping": []
        },
        "postcode": "11111",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "3e0a66ffeeafcc8d5e2f7e200d85b0dc",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1103,
            "channel": 1,
            "email": "test@test.com",
            "first_name": "TEST",
            "last_name": "TEST",
            "phone_number": null,
            "is_active": true,
            "channel_code": "7",
            "erp_code": "760906",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:01.340598Z",
            "created_date": "2017-02-02T09:40:28.855012Z",
            "date_joined": "2017-01-30T08:21:20.657225Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:01.492578Z",
        "mapping": [
            {
                "pk": 902,
                "content_type": 38,
                "object_id": 27,
                "integration_type": "external_company",
                "code": "bc617d60-6b8f-47af-8dd6-a70e011920b8",
                "modified_date": "2017-02-02T17:03:34.590336Z",
                "created_date": "2017-02-02T17:03:34.590310Z"
            },
            {
                "pk": 903,
                "content_type": 38,
                "object_id": 27,
                "integration_type": "external_company",
                "code": "030a6884-e0f0-4ded-9e96-a70e011920b9",
                "modified_date": "2017-02-02T17:03:34.634239Z",
                "created_date": "2017-02-02T17:03:34.634213Z"
            }
        ]
    },
    "billing_address": {
        "pk": 27,
        "email": "test@test.com",
        "phone_number": "0 (198) 895-4431",
        "first_name": "TEST",
        "last_name": "TEST",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z",
            "mapping": [
                {
                    "pk": 1,
                    "content_type": 33,
                    "object_id": 1,
                    "integration_type": "external_company",
                    "code": "TR",
                    "modified_date": "2017-01-24T10:58:56.765596Z",
                    "created_date": "2017-01-24T10:58:56.765567Z"
                }
            ]
        },
        "city": {
            "pk": 71,
            "is_active": true,
            "name": "Afyon",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.270000Z",
            "created_date": "2016-12-22T08:50:57.270000Z",
            "mapping": [
                {
                    "pk": 25,
                    "content_type": 36,
                    "object_id": 71,
                    "integration_type": "external_company",
                    "code": "TR.03",
                    "modified_date": "2017-01-24T10:58:58.771769Z",
                    "created_date": "2017-01-24T10:58:58.771729Z"
                }
            ]
        },
        "line": "test",
        "title": "TEST",
        "township": {
            "pk": 853,
            "is_active": true,
            "name": "DİNAR",
            "city": 71,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:20.112000Z",
            "created_date": "2016-12-22T08:51:20.111000Z",
            "mapping": [
                {
                    "pk": 28,
                    "content_type": 34,
                    "object_id": 853,
                    "integration_type": "external_company",
                    "code": "TR.00304",
                    "modified_date": "2017-01-24T10:58:59.087915Z",
                    "created_date": "2017-01-24T10:58:59.087889Z"
                }
            ]
        },
        "district": {
            "pk": 3679,
            "is_active": true,
            "name": "İNCESU",
            "city": 71,
            "township": 853,
            "postcode": null,
            "zipcode": null,
            "modified_date": "2016-12-22T08:53:12.031000Z",
            "created_date": "2016-12-22T08:53:12.031000Z",
            "mapping": []
        },
        "postcode": "11111",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "3e0a66ffeeafcc8d5e2f7e200d85b0dc",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1103,
            "channel": 1,
            "email": "test@test.com",
            "first_name": "TEST",
            "last_name": "TEST",
            "phone_number": null,
            "is_active": true,
            "channel_code": "7",
            "erp_code": "760906",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:01.340598Z",
            "created_date": "2017-02-02T09:40:28.855012Z",
            "date_joined": "2017-01-30T08:21:20.657225Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:01.492578Z",
        "mapping": [
            {
                "pk": 902,
                "content_type": 38,
                "object_id": 27,
                "integration_type": "external_company",
                "code": "bc617d60-6b8f-47af-8dd6-a70e011920b8",
                "modified_date": "2017-02-02T17:03:34.590336Z",
                "created_date": "2017-02-02T17:03:34.590310Z"
            },
            {
                "pk": 903,
                "content_type": 38,
                "object_id": 27,
                "integration_type": "external_company",
                "code": "030a6884-e0f0-4ded-9e96-a70e011920b9",
                "modified_date": "2017-02-02T17:03:34.634239Z",
                "created_date": "2017-02-02T17:03:34.634213Z"
            }
        ]
    },
    "currency": "try",
    "amount": "16.40",
    "shipping_amount": "8.50",
    "shipping_tax_rate": null,
    "extra_field": {
        "cargo_line_id": "325a79ac-e251-4285-8a32-a70e0119237e"
    },
    "transaction_set": [
        {
            "pk": 2,
            "transaction_type": "purchase",
            "transaction_id": "17030LcZH11794",
            "auth_code": null,
            "pos": {
                "pk": 2,
                "name": "NestPay",
                "slug": "HA",
                "gateway": "omnicore.libs.payment_gateways.nestpay.NestpayGateway",
                "config": {
                    "auth": {
                        "username": "ISBANKAPI",
                        "password": "ISBANK07",
                        "client_id": "700655000100"
                    }
                },
                "resource_url": "https://entegrasyon.asseco-see.com.tr/fim/api",
                "three_d_resource_url": null,
                "channel": 1,
                "gateway_display": "Nestpay",
                "modified_date": "2017-02-02T10:38:15.427494Z",
                "created_date": "2017-02-01T14:01:28.829319Z"
            },
            "main_pos": null,
            "order": {
                "pk": 27,
                "number": "bf7b66149236455",
                "channel": 1,
                "status": "400",
                "date_placed": "2017-01-30T08:28:26.158165Z",
                "customer": 1103,
                "shipping_address": 27,
                "billing_address": 27,
                "currency": "try",
                "amount": "16.40",
                "shipping_amount": "8.50",
                "shipping_tax_rate": null,
                "extra_field": {
                    "cargo_line_id": "325a79ac-e251-4285-8a32-a70e0119237e"
                },
                "payment_option": 2,
                "payment_option_slug": "kredi_karti",
                "bin_number": "454360",
                "installment": 22,
                "installment_count": 1,
                "delivery_type": null,
                "installment_interest_amount": "0.00",
                "cargo_company": 1,
                "invoice_number": "",
                "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": "8.50",
                "shipping_interest_amount": "0.00",
                "tracking_number": null,
                "carrier_shipping_code": null,
                "remote_addr": null,
                "fundstransfertransaction_set": [],
                "has_gift_box": false,
                "gift_box_note": null,
                "external_status": null,
                "client_type": "default",
                "language_code": null,
                "notes": null,
                "delivery_range": null,
                "shipping_option_slug": null,
                "segment": null,
                "modified_date": "2017-02-02T17:03:37.189715Z",
                "checkout_provider_id": null,
                "created_date": "2017-02-02T09:40:29.144797Z"
            },
            "currency": null,
            "user_email": "test@test.com",
            "raw_request": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<CC5Request><OrderId>bf7b661492364559856ff12201f157d9</OrderId><PayerAuthenticationCode>CAVV</PayerAuthenticationCode><Name>ISBANKAPI</Name><Taksit></Taksit><Type>Auth</Type><Expires>**/****</Expires><Number>****************</Number><ClientId>700655000100</ClientId><Cvv2Val>***</Cvv2Val><Currency>949</Currency><GroupId></GroupId><TransId></TransId><Password>ISBANK07</Password><IPAddress>127.0.0.1</IPAddress><Email>example@example.com</Email><Total>16.40</Total></CC5Request>",
            "raw_response": "<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>\n<CC5Response>\n  <OrderId>bf7b661492364559856ff12201f157d9</OrderId>\n  <GroupId>bf7b661492364559856ff12201f157d9</GroupId>\n  <Response>Approved</Response>\n  <AuthCode>P31790</AuthCode>\n  <HostRefNum>703000000296</HostRefNum>\n  <ProcReturnCode>00</ProcReturnCode>\n  <TransId>17030LcZH11794</TransId>\n  <ErrMsg></ErrMsg>\n  <Extra>\n    <SETTLEID>385</SETTLEID>\n    <TRXDATE>20170130 11:28:25</TRXDATE>\n    <ERRORCODE></ERRORCODE>\n    <TERMINALID>00556600</TERMINALID>\n    <MERCHANTID>655000100</MERCHANTID>\n    <CARDBRAND>VISA</CARDBRAND>\n    <CARDISSUER>T. IS BANKASI A.S.</CARDISSUER>\n    <HOSTDATE>0130-112825</HOSTDATE>\n    <NUMCODE>00</NUMCODE>\n  </Extra>\n</CC5Response>\n",
            "is_succeeded": true,
            "amount": "16.40",
            "remote_addr": null,
            "created_date": "2017-02-02T09:40:29.245976Z",
            "pos_slug": "HA",
            "modified_date": "2017-02-05T20:03:17.186801Z"
        }
    ],
    "payment_option": {
        "pk": 2,
        "name": "Credit Card",
        "slug": "credit_Card",
        "payment_type": "credit_card",
        "sort_order": 0,
        "is_active": true,
        "config": {},
        "translations": {
            "tr-tr": {
                "name": "Kredi Kartı"
            }
        },
        "channel": 1,
        "modified_date": "2021-11-10T10:06:41.529791Z",
        "created_date": "2017-02-01T14:46:02.110133Z"
    },
    "payment_option_slug": "kredi_karti",
    "bin_number": "454360",
    "installment": {
        "pk": 22,
        "card": {
            "pk": 23,
            "name": "Maximum",
            "bank": {
                "pk": 16,
                "name": "İş Bankası",
                "slug": "is-bankas",
                "logo": null,
                "channel": 1,
                "modified_date": "2017-02-01T14:34:07.916233Z",
                "created_date": "2017-02-01T14:34:07.916213Z"
            },
            "card_type": {
                "pk": 18,
                "name": "Maximum",
                "slug": "maximum",
                "logo": "http://localhost:8000/media/card_types/2017/02/01/d09bb303-ea29-4eba-8c9a-f9bc056d52d7.jpg",
                "channel": 1,
                "modified_date": "2017-02-01T14:34:08.130132Z",
                "created_date": "2017-02-01T14:34:08.130112Z"
            },
            "card_payment_type": "credit",
            "cash_payment": 10,
            "installment_payment": 2,
            "slug": "maximum",
            "three_d_payment": 10,
            "is_commerce_card": false,
            "channel": 1,
            "modified_date": "2017-02-01T14:34:08.139753Z",
            "created_date": "2017-02-01T14:34:08.139728Z"
        },
        "installment_count": 1,
        "label": "Peşin",
        "interest_rate": "0.000000",
        "is_active": true,
        "config": {},
        "translations": null
    },
    "installment_count": 1,
    "installment_interest_amount": "0.00",
    "cargo_company": {
        "pk": 1,
        "name": "Aras",
        "erp_code": "ARAS",
        "shipping_company": "aras",
        "modified_date": "2018-08-15T12:11:54.402253Z",
        "created_date": "2017-01-30T14:02:18.165573Z"
    },
    "invoice_number": "",
    "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",
    "cancellation_info": {},
    "status_display": "approved",
    "tracking_number": null,
    "is_send": true,
    "cancel_status": null,
    "net_shipping_amount": 8.5,
    "remote_addr": null,
    "language_code": null,
    "fundstransfertransaction_set": [],
    "has_gift_box": false,
    "gift_box_note": null,
    "tracking_url": null,
    "external_status": null,
    "payondeliverytransaction_set": [],
    "loyaltytransaction_set": [],
    "bextransaction_set": [],
    "cancellationplan_set": [],
    "cashregistertransaction_set": [],
    "client_type": "default",
    "shipping_interest_amount": "0.00",
    "delivery_type": null,
    "notes": null,
    "delivery_range": null,
    "shipping_option_slug": null,
    "segment": null,
    "carrier_shipping_code": null,
    "mapping": [
        {
            "pk": 905,
            "content_type": 40,
            "object_id": 27,
            "integration_type": "external_company",
            "code": "1-R-2-180466",
            "modified_date": "2017-02-02T17:03:37.179813Z",
            "created_date": "2017-02-02T17:03:37.179786Z"
        }
    ],
    "ordertransaction_set": [],
    "ordershippinginfo_set": [
        {
            "pk": 4,
            "order": 27,
            "order_number": "bf7b66149236455",
            "shipping_company": "aras",
            "send_request": null,
            "send_response": {},
            "is_send": true,
            "cargo_label": null,
            "modified_date": "2018-08-15T12:11:54.425172Z",
            "created_date": "2018-08-15T12:11:54.425124Z"
        }
    ]
}
```


# Orders Waiting to Send to ERP

`is_send` parameter holds the information whether the ERP system retrieves the order or not. After getting the order you should update the `is_send` parameter to *True.* See the Update section for more information.

<table data-header-hidden><thead><tr><th width="127.3828125"></th><th width="118.359375"></th><th width="102.140625"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>limit</td><td>integer</td><td>query</td><td>Amount of line items per page that will be returned</td></tr><tr><td>is_send</td><td>boolean</td><td>query</td><td>Displays 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><tr><td>status</td><td>string</td><td>query</td><td>Order status code</td></tr></tbody></table>

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

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

Sample HTTP request for retrieving orders not sent to ERP and orders with status “is waiting”.

* `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 = {
   'is_send': False,
   'status': '400'
}

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

**Example Response**

Shows desired orders. All parameters of an order are described in the table below.

Resource properties are in Python format.

<table data-header-hidden><thead><tr><th width="158.734375"></th><th width="137.01171875"></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. You can look up 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. You can look up 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. You can look up 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. You can look up 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</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>Displays whether 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>

```json
{
 "count": 595,
 "next": "https://akinon-bo.akinon.net/api/i1/orders/?limit=2&page=2",
 "previous": null,
 "results": [
   {
     "id": 1,
     "number": "1055565228112825",
     "status": "550",
     "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": "France",
         "code": "fr"
       },
       "city": {
         "id": 1,
         "name": "Paris"
       },
       "line": "Rue Rambuteau",
       "title": "Home",
       "township": {
         "id": 1,
         "name": "75001 Paris"
       },
       "district": {
         "id": 5,
         "name": "75001 Paris"
       },
       "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": "France",
         "code": "fr"
       },
       "city": {
         "id": 1,
         "name": "Paris"
       },
       "line": "Rue Rambuteau",
       "title": "Home",
       "township": {
         "id": 1,
         "name": "75001 Paris"
       },
       "district": {
         "id": 5,
         "name": "75001 Paris"
       },
       "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": "credit_card",
     "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": "21X.XXX.XX.XXX",
     "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
       }
     ]
   },
   {
     "id": 2,
     "number": "1056370250512517",
     "status": "450",
     "date_placed": "2019-06-18T11:57:28.471578Z",
     "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": "France",
         "code": "fr"
       },
       "city": {
         "id": 28,
         "name": "Montpellier"
       },
       "line": "Rue des Pertuisanes",
       "title": "Home2",
       "township": {
         "id": 318,
         "name": "34000 Montpellier"
       },
       "district": {
         "id": 24444,
         "name": "34000 Montpellier"
       },
       "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": "France",
         "code": "fr"
       },
       "city": {
         "id": 28,
         "name": "Montpellier"
       },
       "line": "Rue des Pertuisanes",
       "title": "Home2",
       "township": {
         "id": 318,
         "name": "34000 Montpellier"
       },
       "district": {
         "id": 24444,
         "name": "34000 Montpellier"
       },
       "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": "21X.XXX.XX.XXX",
     "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
       }
     ]
   }
 ]
}
```


# Update Order and Order Item

The Order Update API provides endpoints that allow users to modify specific aspects of an order or its individual items.

## <mark style="color:red;">`PATCH`</mark> <mark style="color:red;">Update Order</mark>

This endpoint allows users to update the `is_send` status of an order. The `is_send` parameter should be set to `true` to indicate that the order has been communicated to the ERP system.

This endpoint does not support updates to other order details. Any modifications beyond `is_send` must be performed through the `/order_items/` endpoint.

The path variable (pk) specifies the order to be updated. If no errors occur, the response will always reflect the order's most recent status.

**Path:** `{omnitron_url}/api/v1/orders/{pk}/`

**Authorization:** `Token <OMNITRON_ACCESS_TOKEN>`

**Request Parameters**

<table><thead><tr><th width="167.625">Parameter</th><th width="165.265625">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>is_send</td><td>boolean</td><td>It should be set to true if ERP is informed about the order.</td></tr></tbody></table>

**Example Request**

```py
import requests
import json

url = "{omnitron_url}/api/v1/orders/{pk}/"

headers = {
    'Authorization': 'Token <OMNITRON_ACCESS_TOKEN>',
    'Content-Type': 'application/json'
}

payload = {
    "is_send": true,
    }
}

response = requests.patch(url, headers=headers, data=json.dumps(payload))
print(response.json)
```

**Example Response (200 OK)**

```json
{
    "pk": 12345,
    "number": "2792097964712363",
    "channel": 1,
    "status": "450",
    "date_placed": "2024-12-17T10:36:59.077305Z",
    "customer": 458899,
    "shipping_address": 122333,
    "billing_address": 122333,
    "currency": "aed",
    "amount": "286.10",
    "shipping_amount": "6.10",
    "shipping_tax_rate": null,
    "extra_field": {
        "custom_note": "Please deliver between 9 AM and 5 PM."
    },
    "payment_option": 332,
    "payment_option_slug": "Credit_Card",
    "bin_number": "555555",
    "installment": 233,
    "installment_count": 1,
    "delivery_type": "standard",
    "installment_interest_amount": "0.00",
    "cargo_company": 34,
    "invoice_number": "INV123456",
    "invoice_date": "2025-01-18T10:00:00Z",
    "e_archive_url": "https://example.com/invoice",
    "refund_amount": "100.00",
    "discount_refund_amount": "0.00",
    "shipping_refund_amount": "0.00",
    "discount_amount": "0.00",
    "is_send": true,
    "net_shipping_amount": "6.10",
    "shipping_interest_amount": "0.00",
    "tracking_number": "TRACK123456",
    "carrier_shipping_code": "CARRIER123",
    "remote_addr": "176.41.48.148",
    "fundstransfertransaction_set": [],
    "has_gift_box": true,
    "gift_box_note": "Happy Birthday!",
    "external_status": 1,
    "client_type": "ios",
    "language_code": "en-us",
    "notes": "Customer requested faster delivery",
    "delivery_range": {
        "lower": "2025-01-20T09:00:00Z",
        "upper": "2025-01-20T18:00:00Z"
    },
    "shipping_option_slug": "cdek-cargo",
    "segment": "VIP",
    "modified_date": "2025-01-18T10:10:00Z",
    "checkout_provider_id": null,
    "created_date": "2024-12-17T10:37:04.440088Z",
    "cancellation_info": {},
    "shipping_company": "cdek",
    "cancel_status": null,
    "defined_tracking_url": "https://example.com/shipment",
    "installment_free": false
}
```

**Example Responses (400 Bad Request)**

```
{"detail": "JSON parse error - Expecting ',' delimiter: line 50 column 5 (char 287)"}
```

```
{"status": ["No matching type."]}
```

## <mark style="color:red;">`PATCH`</mark> <mark style="color:red;">Update Order Item</mark>

This endpoint enables users to update the details of an order item. Request body parameters can be used individually or in combination with others. The path variable (pk) specifies the order item to be updated.

**Path:** `{omnitron_url}/api/v1/order_items/{pk}/`

**Authorization:** `Token <OMNITRON_ACCESS_TOKEN>`

**Request Parameters**

<table><thead><tr><th width="178.0390625">Parameter</th><th width="164.76171875">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>status</td><td>string (enum)</td><td>The status of the order item. Allowed values are order status codes.</td></tr><tr><td>extra_field</td><td>object</td><td>Any JSON data is allowed to be stored with the order item. Endpoint does not update or delete fields which are not included in the JSON data.</td></tr><tr><td>attributes</td><td>object</td><td>An object where all values must be string or boolean. The data in the body will be the final one on the item as a whole.</td></tr><tr><td>attributes_kwargs</td><td>object</td><td>An object where all values must be an object. The nested objects should include additional information about the attributes of the order item. The data in the body will be the final one on the item as a whole.</td></tr><tr><td>cancel_status</td><td>string (enum &#x26; nullable)</td><td>The status of cancellation processes of the order item. Allowed values are included in the cancel status list.</td></tr><tr><td>tracking_number</td><td>string (nullable)</td><td>The tracking number provided by the shipping company for the order item.</td></tr><tr><td>defined_tracking_url</td><td>string (nullable)</td><td>URL for shipment tracking.</td></tr><tr><td>invoice_number</td><td>string (nullable)</td><td>Number value of the invoice related to the order item.</td></tr><tr><td>invoice_date</td><td>string (nullable)</td><td>Date value of the invoice related to the order item and must be formatted as UTC ISO 8601.</td></tr><tr><td>e_archive_url</td><td>string (nullable)</td><td>The URL where the PDF version of the invoice can be accessed. This link allows customers or stakeholders to view and download the invoice directly from the Omnitron panel or integrated sales channels.</td></tr><tr><td>carrier_shipping_code</td><td>string (nullable)</td><td>Tracking code assigned by the carrier.</td></tr><tr><td>shipping_company</td><td>string (enum &#x26; nullable)</td><td>The name of the shipping company assigned to the order item. This field represents the official carrier used for tracking and processing the shipment, such as a general shipping service provider. Allowed values are limited to the companies and their hard-coded defined names in Omnitron.</td></tr><tr><td>parent</td><td>integer or string (nullable)</td><td>The input must be the primary key value of an existing order item.</td></tr><tr><td>shipped_date</td><td>string (nullable)</td><td>The date when the order item was shipped. It must be formatted as UTC ISO 8601.</td></tr><tr><td>delivered_date</td><td>string (nullable)</td><td>The date when the order item was delivered. It must be formatted as UTC ISO 8601.</td></tr><tr><td>estimated_delivery_date</td><td>string (nullable)</td><td>The estimated delivery date for the order item. It must be formatted as YYYY-MM-DD.</td></tr><tr><td>defined_shipping_company</td><td>string (nullable)</td><td>A value representing the actual shipping company that the end user should see, which may differ from the "shipping_company" field. For example, if the internal system uses one shipping service for processing but the actual delivery is handled by a different carrier, this field will contain the name of the carrier responsible for the delivery.</td></tr><tr><td>data_source</td><td>integer or string (nullable)</td><td>The input must be the primary key value of an existing data source. The DataSource model contains detailed information about the seller, supplier, or related data entity.</td></tr><tr><td>shipping_option_group</td><td>integer or string (nullable)</td><td>The input must be the primary key value of an existing shipping option group. Shipping option group value represents the selected shipping option for the order item. For more details see: <a href="https://docs.akinon.com/technical-guides/commerce/data-source-shipping-options">Data Source Shipping Options</a> and <a href="https://docs.akinon.com/technical-guides/commerce/attribute-based-shipping-options">Attribute Based Shipping Options</a>.</td></tr></tbody></table>

### <mark style="color:red;">Key Points</mark>

* Requests to change the status to "cancelled" or "refunded" will be rejected, and no updates will be made to the order item.
* The request body must not include the following attribute fields:
  * `split_from_order_item_pk`
  * `old_order_item_omnitron_id`
  * `old_order_item_id`
  * `old_product_sku`
  * `old_price`
  * `new_product_sku`
  * `new_price`
* If the current `cancel_status` is "approved" for the order item, the request body must include the corresponding field with a non-null value, and its value cannot be "confirmed".
* If the current `cancel_status` is "waiting\_for\_payment" for the order item, the request body must include the corresponding field with a non-null value, and its value cannot be any of the following:
  * `waiting`
  * `confirmation_waiting`
  * `confirmed`, `approved`
  * `rejected`
* If the current status is **100** or **600**, the following fields cannot be updated:
  * `tracking_number`
  * `defined_tracking_url`
  * `defined_shipping_company`.
* If the `status` code in the payload is **500** and the `shipped_date` of the related order item is null, the date will be set to the request time.
* If the `status` code in the payload is **550** and the `delivered_date` of the related order item is null, the date will be set to the request time.
* Including either `invoice_number` or `tracking_number` in the request body will change the order item’s status to 450 if the current status is 400, regardless of the value in the status field of the request body.
* If the request body includes any of the following fields, the order associated with the order item will be updated with the provided values. However, if the order's payment type is "pay on delivery" and the order already has a tracking number, it will remain unchanged:
  * `invoice_number`
  * `invoice_date`
  * `e_archive_url`
  * `tracking_number`
  * `shipping_company`
  * `status`
  * `defined_tracking_url`

**Example Request**

```py
import requests
import json

url = "{omnitron_url}/api/v1/order_items/{pk}/"
headers = {
    'Authorization': 'Token <OMNITRON_ACCESS_TOKEN>',
    'Content-Type': 'application/json'
}
payload = {
    "status": "450",
    "extra_field": {
        "processing_notes": "Special handling required",
        "customer_preference": "Fragile package"
    },
    "attributes": {
        "gift_wrap": true,
        "priority_shipping": true
    },
    "attributes_kwargs": {
        "gift_wrap": {
            "message": "Happy Birthday",
            "paper_color": "gold"
        },
        "priority_shipping": {
            "reason": "Time-sensitive delivery",
            "expedited": true
        }
    },
    "tracking_number": "TRACK789012",
    "defined_tracking_url": "https://tracking.fastexpress.com/TRACK789012",
    "defined_shipping_company": "FastExpress",
    "invoice_number": "INV789012",
    "invoice_date": "2025-01-24T14:30:00Z",
    "e_archive_url": "https://example.com/invoices/789012",
    "carrier_shipping_code": "FAST-789012",
    "shipping_company": "FastExpress",
    "shipped_date": "2025-01-24T15:00:00Z",
    "delivered_date": "2025-01-26T10:00:00Z",
    "estimated_delivery_date": "2025-01-26",
    "cancel_status": null,
    "parent": null,
    "data_source": null,
    "shipping_option_group": null
}

response = requests.patch(url, headers=headers, data=json.dumps(payload))
print(response.text)

```

**Example Response (200 OK)**

```json
{
    "pk": 1340653,
    "order": 946856,
    "product": 1891,
    "status": "450", 
    "price_currency": "try",
    "price": "109.99",
    "tax_rate": "0.18",
    "extra_field": {
        "processing_notes": "Special handling required",
        "customer_preference": "Fragile package",
        "price_extra_field": {},
        "stock_extra_field": {}
    },
    "price_list": 34,
    "stock_list": 34,
    "invoice_number": "INV789012",
    "invoice_date": "2025-01-24T14:30:00Z",
    "e_archive_url": "https://example.com/invoices/789012",
    "tracking_number": "TRACK789012",
    "carrier_shipping_code": "FAST-789012",
    "shipping_company": "FastExpress",
    "shipment_code": null,
    "external_status": null,
    "discount_amount": "11.55",
    "retail_price": "111.99",
    "attributes": {
        "gift_wrap": true,
        "priority_shipping": true
    },
    "attributes_kwargs": {
        "gift_wrap": {
            "message": "Happy Birthday",
            "paper_color": "gold"
        },
        "priority_shipping": {
            "reason": "Time-sensitive delivery",
            "expedited": true
        }
    },
    "image": null,
    "parent": null,
    "shipped_date": "2025-01-24T15:00:00Z",
    "delivered_date": "2025-01-26T10:00:00Z",
    "estimated_delivery_date": "2025-01-26",
    "modified_date": "2025-01-24T08:45:18.831693Z",
    "created_date": "2024-10-11T13:56:35.894193Z",
    "defined_tracking_url": "https://tracking.fastexpress.com/TRACK789012",
    "defined_shipping_company": "FastExpress",
    "cancel_status": null,
    "installment_interest_amount": "0.00",
    "is_tradable": false,
    "datasource": null,
    "localized_attributes": {},
    "localized_attributes_kwargs": {},
    "cancellation_reconciliation": null,
    "reconciliation": null,
    "forced_refund": false,
    "original_stock": 0,
    "shipping_option_group": null
}

```

**Example Responses (400 Bad Request)**

```
{"detail": "JSON parse error - Expecting ',' delimiter: line 50 column 5 (char 287)"}
```

```
{"status": ["No matching type."]}
```

## <mark style="color:red;">`PATCH`</mark> <mark style="color:red;">Update Order Statuses in Bulk</mark>

When the order is invoiced or the shipping process is managed outside of Omnitron, the following endpoint is used to save this order information to Omnitron. Based on this information, Omnitron decides on the cancellation/return processes of the order.

For example, if the delivery processes are controlled from outside of Omnitron (e.g., an ERP system), the status of the order line should be updated when the cargo information is received. The order should be updated with the status information corresponding to the Omnitron order status table along with the tracking number received from the courier company.

**Path:** `{omnitron_url}/api/i1/order_items/bulk_status_update/`

**Authorization:** `Token <OMNITRON_ACCESS_TOKEN>`

**Request Parameters**

<table><thead><tr><th width="171.1484375">Parameter</th><th width="138.0390625">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>id</td><td>Unique identifier for the order item.</td></tr><tr><td>invoice_number</td><td>string</td><td>The invoice number generated for the order item.</td></tr><tr><td>invoice_date</td><td>string</td><td>The date when the invoice was issued. The format is expected to follow ISO 8601 standards, e.g., <code>YYYY-MM-DDTHH:MM:SSZ</code></td></tr><tr><td>e_archive_url</td><td>string</td><td>The URL where the PDF version of the invoice can be accessed. This link allows customers or stakeholders to view and download the invoice directly from the Omnitron panel or integrated sales channels.</td></tr><tr><td>status</td><td>string</td><td>The current status of the order item, mapped to Omnitron's predefined status codes. Allowed values are order status codes.</td></tr><tr><td>tracking_number</td><td>string</td><td>The tracking number provided by the shipping company for the order item.</td></tr><tr><td>shipping_company</td><td>enum</td><td>The name of the shipping company assigned to the order. This field represents the official carrier used for tracking and processing the shipment, such as a general shipping service provider. Allowed values are limited to the companies and their hard-coded defined names in Omnitron.</td></tr></tbody></table>

**Example Request**

```javascript
import requests
import json

url = "{omnitron_url}/api/i1/order_items/bulk_status_update/"

headers = {
    'Authorization': 'Token <OMNITRON_ACCESS_TOKEN>',
    'Content-Type': 'application/json'
}

data = {
    "orderitem_set": [
        {
            # Invoice issued, not shipped
            "id": 1,
            "status": "450",         
            "invoice_number": "SEP123123",
            "invoice_date": "2021-07-14T00:00:00.000000Z",
            "e_archive_url": "http://e.archive.url/SEP123123",
        },
        {
            # Invoice issued and shipped
            "id": 2,
            "status": "500",
            "invoice_number": "SEP123123",
            "invoice_date": "2021-07-14T00:00:00.000000Z",
            "tracking_number": "TR123123",
            "e_archive_url": "http://e.archive.url/SEP123123",
            "shipping_company": "ups"
        },
        {
            # Shipped only
            "id": 3,
            "status": "500",
            "tracking_number": "TR444444",
            "shipping_company": "ups"
        }
    ]
}

response = requests.patch(url, headers=headers , data=json.dumps(data))
print(response.text)
```

**Example Response (200 OK)**

```javascript
[
  {
    "id": 1,
    "order": 1,
    "product_sku": "1185185001",
    "status": "500",
    "price_currency": "try",
    "price": "100.00",
    "tax_rate": "18.00",
    "extra_field": {},
    "price_list": 1,
    "stock_list": 1,
    "cancel_status": null,
    "invoice_number": "SEP123123",
    "invoice_date": "2021-07-14T00:00:00Z",
    "e_archive_url": "http://e.archive.url/SEP123123",
    "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
  },
  {
    "id": 2,
    "order": 1,
    "product_sku": "1185185002",
    "status": "500",
    "price_currency": "try",
    "price": "86.00",
    "tax_rate": "18.00",
    "extra_field": {},
    "price_list": 1,
    "stock_list": 1,
    "cancel_status": null,
    "invoice_number": "SEP123123",
    "invoice_date": "2021-07-14T00:00:00Z",
    "e_archive_url": "http://e.archive.url/SEP123123",
    "installment_interest_amount": "0.00",
    "tracking_number": "TR123123",
    "carrier_shipping_code": null,
    "shipping_company": "ups",
    "shipment_code": null,
    "external_status": null,
    "discount_amount": "0.00",
    "retail_price": null,
    "attributes": {},
    "attributes_kwargs": {},
    "image": null
  },
  {
    "id": 3,
    "order": 1,
    "product_sku": "1185185003",
    "status": "500",
    "price_currency": "try",
    "price": "17.00",
    "tax_rate": "18.00",
    "extra_field": {},
    "price_list": 1,
    "stock_list": 1,
    "cancel_status": null,
    "invoice_number": "SEP123123",
    "invoice_date": "2021-07-14T00:00:00Z",
    "e_archive_url": "http://e.archive.url/SEP123123",
    "installment_interest_amount": "0.00",
    "tracking_number": "TR444444",
    "carrier_shipping_code": null,
    "shipping_company": "ups",
    "shipment_code": null,
    "external_status": null,
    "discount_amount": "0.00",
    "retail_price": null,
    "attributes": {},
    "attributes_kwargs": {},
    "image": null
  }
]
```

**Example Responses (400 Bad Request)**

If any error occurs during the bulk operation, the response specifies which order\_item is incorrect along with the error messages.

For example:

```javascript
[
    {
        "message": {
            "status": [
                "No matching type."
            ]
        },
        "args": {
            "orderitem_id": "123"
        }
    },
    {
        "message": [
            "You can only update one order at a time."
        ],
        "args": {
            "orderitem_id": "122"
        }
    }
]
```


# Stock Reservation Release

When the order is created, the Omnitron starts to hold reservations on stock. This reservation is used to synchronize the stock between the ERP system and the Omnitron. If the order has been successfully registered in the ERP, a request must be sent to Omnitron with the order line created in the ERP to release the reservation.

Due to the information sent to the endpoint below, Omnitron both keeps the information of the order line created in the ERP and removes the reservation for the order.

<table data-header-hidden><thead><tr><th width="166.625"></th><th width="103.125"></th><th width="90.71875"></th><th width="116.0546875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Reqiured</strong></td><td><strong>Description</strong></td></tr><tr><td><code>api_token</code></td><td>string</td><td>header</td><td>mandatory</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td><code>update_stock</code></td><td>boolean</td><td>data</td><td>optional</td><td>If it is <code>True</code>, the stock reservation is released. Default is <code>True</code>.</td></tr><tr><td><code>code</code></td><td>string</td><td>data</td><td>mandatory</td><td>Unique ID of the order line on the ERP side.</td></tr><tr><td><code>{order_item_id}</code></td><td>string</td><td>query</td><td>mandatory</td><td>Order item ID.</td></tr></tbody></table>

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Release Stock Reservation</mark>

**Path:** `/api/i1/order_items/{order_item_id}/create_mapping/`

Sample HTTP request to create mapping and release a stock.

* `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
import json

url = "https://{customer_api_url}/api/v1/order_items/{order_item_id}/create_mapping/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
 "update_stock": True,
 "code": "{erp_orderitem_code}"
}

response = requests.post(url, headers=headers , data=json.dumps(data))
print(response.text)
```

**Example Response**

Returns Integration Mapping object data.

`object_id` is the ID of the `order_item`, code is the given code, `content_type` shows the data table (ex: Product, Order etc.) in the Omnitron system. Users can get all table ContentType information via HTTP GET request to `/api/v1/content_types/` endpoint.

```json
{
 "pk": 4183,
 "content_type": 66,
 "object_id": 46761,
 "integration_type": "external_company",
 "code": "<erp_orderitem_code>"
}
 
```

#### <mark style="color:red;">Why This Mapping Matters</mark>

The purpose of this mapping is to make the ERP's own order-item code a queryable, retrievable key in Omnitron going forward. Once a mapping is created, the related stock reservation is automatically released.

This unlocks two things in practice:

**Reverse lookup by the ERP's own code**\
Once the mapping row exists, the ERP can query Omnitron later using its own identifier instead of Omnitron's internal ID:

```bash
GET /api/i1/order_items/?mapping__code__exact={erp_orderitem_code}
```

This is useful when the ERP's system of record keys everything off its own codes and doesn't want to persist Omnitron's primary keys everywhere.

**It is echoed back on re-fetch**\
The integration-facing detail payload includes a `mapping` field. So when the ERP later re-fetches an order or order item via the integration API, Omnitron returns the ERP's own code alongside its data — useful for reconciliation or logging without a second lookup.


# Order Cancellation

All orders can be canceled/returned, as well as order items in the order can be canceled/returned partially.

It is not possible to partially cancel some and return some inside the order. It is only possible to initiate either the cancellation or return processes for the entire order.

<table data-header-hidden><thead><tr><th width="121.2890625"></th><th width="110.66015625"></th><th width="92.0234375"></th><th width="92.30859375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td>✓</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>order</td><td>integer</td><td>data</td><td>✓</td><td>Order ID</td></tr><tr><td>is_all</td><td>boolean</td><td>data</td><td></td><td>If True cancels the order with all order items under it. Default False</td></tr><tr><td>cancel_items</td><td>dict</td><td>data</td><td>✓</td><td>If is_all True, you need to send cancel_items as an empty list. Otherwise need to sent Order items that will cancel</td></tr><tr><td>forced_refund_amount</td><td>string</td><td>data</td><td>✓</td><td>Used in Omnitron operating mechanism, default null must be sent</td></tr><tr><td>reasons</td><td>dict</td><td>data</td><td>✓</td><td>Cancellation or refund reason code</td></tr><tr><td>is_cargo_refund</td><td>boolean</td><td>data</td><td></td><td>Cargo cost will be refunded. Default value is False. You can switch cancellation rules via Cancellation Strategy. See the Cancellation Strategies section for more information.</td></tr><tr><td>refund_invoice_number</td><td>string</td><td>data</td><td></td><td>Refund invoice number for the order.</td></tr><tr><td>ibans</td><td>dict</td><td>data</td><td></td><td>Iban information can be seen in the Cancellation Request. Used for only Fund Transfer transaction cancellations. Not required. Example structure is {`{"order_item_id": "iban"}`}</td></tr><tr><td>holder_names</td><td>dict</td><td>data</td><td></td><td>Holder name information can be seen in the Cancellation Used for only Fund Transfer transaction cancellations. Not required. Example structure is {`{"order_item_id": "holder_name"}`}</td></tr></tbody></table>

In the example below, all order items are canceled.

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Cancel Order</mark>

**Path:** `/api/i1/orders/{order_id}/cancel/`

Sample HTTP request to cancel all order items in the order.

`content_type` header represents the response type.

`Authorization` header is a required header for authentication. You can retrieve api\_token with login.

**Example Request**

<pre class="language-python"><code class="lang-python"><strong>import requests
</strong>import json

url = "https://{customer_api_url}/api/v1/orders/{order_id}/cancel/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
  "order": 167848, # order id
  "is_all": True, 
  "cancel_items": [],
  "forced_refund_amount": None,
  "reasons": {
      "46761": 1 # order item id : reason code
  }
}

response = requests.post(url, headers=headers , data=json.dumps(data))
print(response.text)
</code></pre>

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">Cancel Order - Partial</mark>

**Path:** `/api/i1/orders/{order_id}/cancel/`

In the example below, the order items are partially canceled.

Sample HTTP request to cancel desired order items in the order.

**Example Request**

```python
import requests
import json

url = "https://{customer_api_url}/api/v1/orders/{order_id}/cancel/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

data = {
  "order": 167848, # order id
  "is_all": False, 
  "cancel_items": [
    46761,
    46762,
  ],
  "forced_refund_amount": None,
  "reasons": {
      "46761": 1,# order item id : reason code
      "46762": 1 # order item id : reason code

  }
}

response = requests.post(url, headers=headers , data=json.dumps(data))
print(response.text)
```

**Example Response**

Returns given order detail information. Expected status code 200-OK. To see more information about response fields, see the Get Order section.

```json

{
    "pk": 29,
    "number": "4cd342afffe8464",
    "channel": {
        "pk": 1,
        "name": "Shop",
        "channel_type": "web",
        "catalog": 1,
        "modified_date": "2022-06-13T10:47:45.640791Z",
        "created_date": "2017-01-22T23:33:29.178976Z",
        "category_tree": null,
        "is_active": true,
        "conf": {
            "username": "John",
            "feature_flags": {},
            "auth_token": "AILeoZiTaWGHEIHSvfdaaURqFfBEWgbhdNrlxShtu",
            "server": "http://localhost:8080/api/v1/",
            "localized_cancel_mail_subject": {},
            "sales_url": "http://www.brand.com",
            "password": "Password12345!"
        },
        "schema": {}
    },
    "status": "50",
    "date_placed": "2017-02-01T11:07:24.155206Z",
    "customer": {
        "pk": 1104,
        "channel": 1,
        "email": "samplemail@akinon.com",
        "first_name": "John",
        "last_name": "Doe",
        "phone_number": null,
        "is_active": true,
        "channel_code": "2",
        "erp_code": "1-4-3473443",
        "extra_field": {},
        "modified_date": "2017-02-05T19:22:03.144426Z",
        "created_date": "2017-02-02T09:40:29.912650Z",
        "date_joined": "2017-01-24T15:08:49.308306Z",
        "email_allowed": false,
        "sms_allowed": false,
        "call_allowed": false,
        "gender": null,
        "attributes": {},
        "user_type": null,
        "date_of_birth": null
    },
    "shipping_address": {
        "pk": 28,
        "email": "samplemail@akinon.com",
        "phone_number": "9999999999",
        "first_name": "John",
        "last_name": "Doe",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z"
        },
        "city": {
            "pk": 62,
            "is_active": true,
            "name": "İstanbul",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.030000Z",
            "created_date": "2016-12-22T08:50:57.030000Z"
        },
        "line": "line",
        "title": "title",
        "township": {
            "pk": 156,
            "is_active": true,
            "name": "SARIYER",
            "city": 62,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:02.022000Z",
            "created_date": "2016-12-22T08:51:02.022000Z"
        },
        "district": null,
        "postcode": "99999",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "d7f63eea389f78116fdf95d0d0b23719a",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1104,
            "channel": 1,
            "email": "samplemail@akinon.com",
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": null,
            "is_active": true,
            "channel_code": "2",
            "erp_code": "1-4-3473443",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:03.144426Z",
            "created_date": "2017-02-02T09:40:29.912650Z",
            "date_joined": "2017-01-24T15:08:49.308306Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:03.276431Z"
    },
    "billing_address": {
        "pk": 28,
        "email": "samplemail@akinon.com",
        "phone_number": "9999999999",
        "first_name": "John",
        "last_name": "Doe",
        "country": {
            "pk": 1,
            "is_active": true,
            "name": "Turkey",
            "code": "tr",
            "translations": {
                "tr-tr": {
                    "name": "Türkiye"
                }
            },
            "modified_date": "2022-08-15T07:20:28.680740Z",
            "created_date": "2016-12-22T08:50:55.358000Z"
        },
        "city": {
            "pk": 62,
            "is_active": true,
            "name": "İstanbul",
            "country": 1,
            "translations": null,
            "priority": null,
            "postcode": null,
            "modified_date": "2016-12-22T08:50:57.030000Z",
            "created_date": "2016-12-22T08:50:57.030000Z"
        },
        "line": "line",
        "title": "title",
        "township": {
            "pk": 156,
            "is_active": true,
            "name": "SARIYER",
            "city": 62,
            "postcode": null,
            "modified_date": "2016-12-22T08:51:02.022000Z",
            "created_date": "2016-12-22T08:51:02.022000Z"
        },
        "district": null,
        "postcode": "31213",
        "notes": null,
        "company_name": null,
        "tax_office": null,
        "tax_no": null,
        "e_bill_taxpayer": false,
        "hash_data": "d7f63eea389f78116dff95d0d0b23719a",
        "address_type": "customer",
        "retail_store": null,
        "remote_id": null,
        "identity_number": null,
        "extra_field": {},
        "customer": {
            "pk": 1104,
            "channel": 1,
            "email": "samplemail@akinon.com",
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": null,
            "is_active": true,
            "channel_code": "2",
            "erp_code": "1-4-3473443",
            "extra_field": {},
            "modified_date": "2017-02-05T19:22:03.144426Z",
            "created_date": "2017-02-02T09:40:29.912650Z",
            "date_joined": "2017-01-24T15:08:49.308306Z",
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null
        },
        "is_active": true,
        "modified_date": "2017-02-05T19:22:03.276431Z"
    },
    "currency": "try",
    "amount": "10.94",
    "shipping_amount": "8.50",
    "shipping_tax_rate": null,
    "extra_field": {
        "cargo_line_id": "9e52cd4f-921a-4680-avaea-a70f0085f18a"
    },
    "orderitem_set": [
        {
            "pk": 115,
            "order": 29,
            "product": {
                "pk": 5957,
                "name": "Limon",
                "base_code": "1KMEYV0011",
                "sku": "2672881053987",
                "product_type": "0",
                "is_active": true,
                "parent": null,
                "attributes": {
                    "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "erp_ProductCode": "1KMEYV0011108",
                    "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "uretim_yeri": "ÇİN",
                    "renk": "SARI",
                    "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt07Desc": "50+50 promosyon",
                    "erp_color": "SARI",
                    "erp_ProductAtt01Desc": "DIŞ ALIM",
                    "materyal": "POLYFOAM",
                    "integration_ProductCode": "1KMEYV0011108",
                    "integration_ProductAtt01Desc": "DIŞ ALIM",
                    "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "erp_ProductHierarchyLevel02": "Dekoratif",
                    "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                    "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                    "erp_ProductAtt02Desc": "Yapay Meyve",
                    "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                    "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                    "integration_ProductHierarchyLevel02": "Dekoratif",
                    "erp_ProductAtt25Desc": "ÇİN",
                    "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                    "erp_ProductAtt20Desc": "POLYFOAM",
                    "integration_ProductAtt02Desc": "Yapay Meyve",
                    "integration_ProductAtt07Desc": "50+50 promosyon",
                    "filtre_renk1": "Sarı"
                },
                "attributes_kwargs": {
                    "erp_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "erp_ProductHierarchyLevel02": {
                        "value": "Dekoratif",
                        "data_type": "dropdown",
                        "label": "Dekoratif"
                    },
                    "filtre_renk1": {
                        "value": "Sarı",
                        "data_type": "dropdown",
                        "label": "Sarı"
                    },
                    "erp_color": {
                        "value": "SARI",
                        "data_type": "dropdown",
                        "label": "SARI"
                    },
                    "integration_ProductHierarchyLevel01": {
                        "value": "TEKSTİL DIŞI",
                        "data_type": "dropdown",
                        "label": "TEKSTİL DIŞI"
                    },
                    "integration_ProductHierarchyLevel02": {
                        "value": "Dekoratif",
                        "data_type": "dropdown",
                        "label": "Dekoratif"
                    },
                    "renk": {
                        "value": "SARI",
                        "data_type": "dropdown",
                        "label": "SARI"
                    }
                },
                "extra_attributes": {},
                "group_products": [],
                "productimage_set": [
                    {
                        "pk": 17180,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/d907e2f2-b615-454c-a383-ca1ae7e93faf.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.574308Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    },
                    {
                        "pk": 17181,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/982815c2-ae3e-4cb1-b126-93ab2622b57c.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.640015Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    },
                    {
                        "pk": 17182,
                        "status": "active",
                        "image": "http://localhost:8000/media/products/2017/01/23/5957/c1bb563c-b2bd-4478-99ab-cc5136d55a84.jpg",
                        "order": 0,
                        "created_date": "2017-01-23T15:26:39.704360Z",
                        "specialimage_set": [],
                        "modified_date": "2021-11-03T10:04:57.786718Z"
                    }
                ],
                "attribute_set": 66,
                "custom_attribute_set": null,
                "productization_date": "2017-01-23T17:42:56.863166Z",
                "listing_code": null,
                "data_source": null,
                "modified_date": "2021-02-23T13:45:37.864572Z",
                "uuid": "2e200443-b5ea-4909-b75f-v02912fc9e4cd",
                "created_date": "2017-01-22T22:20:51.092944Z"
            },
            "status": "50",
            "price_currency": "try",
            "price": "2.44",
            "tax_rate": "18.00",
            "extra_field": {},
            "price_list": {
                "pk": 1,
                "name": "default_price_list",
                "code": "default_price_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:44.637000Z",
                "created_date": "2017-01-22T12:14:44.637000Z",
                "currency": "try"
            },
            "stock_list": {
                "pk": 1,
                "name": "default_stock_list",
                "code": "default_stock_list",
                "is_auto_sync": true,
                "modified_date": "2017-01-22T12:14:18.030000Z",
                "created_date": "2017-01-22T12:14:18.030000Z"
            },
            "invoice_number": null,
            "invoice_date": null,
            "e_archive_url": null,
            "cancel_status": "waiting",
            "status_display": "cancellation waiting",
            "installment_interest_amount": "0.00",
            "net_amount": "2.44",
            "tracking_number": "123",
            "shipping_company": null,
            "discount_amount": "0.00",
            "shipment_code": null,
            "benefitapplicant_set": [],
            "external_status": null,
            "retail_price": null,
            "attributes": {},
            "attributes_kwargs": {},
            "tracking_url": null,
            "image": null,
            "parent": null,
            "data_source": null,
            "estimated_delivery_date": null,
            "datasource": null
        }
    ],
    "discountitem_set": [],
    "transaction_set": [
        {
            "pk": 4,
            "transaction_type": "purchase",
            "transaction_id": "17032OHXH15476",
            "auth_code": null,
            "pos": {
                "pk": 2,
                "name": "NestPay",
                "slug": "HA",
                "gateway": "omnicore.libs.payment_gateways.nestpay.NestpayGateway",
                "config": {
                    "auth": {
                        "username": "ISBANKAPI",
                        "password": "ISBANK07",
                        "client_id": "7006550002100"
                    }
                },
                "resource_url": "https://entegrasyon.asseco-see.com.tr/fim/api",
                "three_d_resource_url": null,
                "channel": 1,
                "gateway_display": "Nestpay",
                "modified_date": "2017-02-02T10:38:15.427494Z",
                "created_date": "2017-02-01T14:01:28.829319Z"
            },
            "main_pos": null,
            "order": {
                "pk": 29,
                "number": "4cd342gafffe8464",
                "channel": 1,
                "status": "50",
                "date_placed": "2017-02-01T11:07:24.155206Z",
                "customer": 1104,
                "shipping_address": 28,
                "billing_address": 28,
                "currency": "try",
                "amount": "10.94",
                "shipping_amount": "8.50",
                "shipping_tax_rate": null,
                "extra_field": {
                    "cargo_line_id": "9e52cd4f-921a-4680-a4aea-a70f0085f18a"
                },
                "payment_option": 2,
                "payment_option_slug": "kredi_karti",
                "bin_number": "454360",
                "installment": 22,
                "installment_count": 1,
                "delivery_type": null,
                "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": "8.50",
                "shipping_interest_amount": "0.00",
                "tracking_number": "123",
                "carrier_shipping_code": null,
                "remote_addr": null,
                "fundstransfertransaction_set": [],
                "has_gift_box": false,
                "gift_box_note": null,
                "external_status": null,
                "client_type": "default",
                "language_code": null,
                "notes": null,
                "delivery_range": null,
                "shipping_option_slug": null,
                "segment": null,
                "modified_date": "2022-12-20T10:30:46.666779Z",
                "checkout_provider_id": null,
                "created_date": "2017-02-02T09:40:30.624692Z"
            },
            "currency": null,
            "user_email": "samplemail@akinon.com",
            "raw_request": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<CC5Request><OrderId>4cd342afffe8464cb00d7caf6a522a27</OrderId><PayerAuthenticationCode>CAVV</PayerAuthenticationCode><Name>ISBANKAPI</Name><Taksit></Taksit><Type>Auth</Type><Expires>**/****</Expires><Number>****************</Number><ClientId>700655000100</ClientId><Cvv2Val>***</Cvv2Val><Currency>949</Currency><GroupId></GroupId><TransId></TransId><Password>ISBANK07</Password><IPAddress>127.0.0.1</IPAddress><Email>example@example.com</Email><Total>10.94</Total></CC5Request>",
            "raw_response": "<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>\n<CC5Response>\n  <OrderId>4cd342afffe8464cb00d7caf6a522a27</OrderId>\n  <GroupId>4cd342afffe8464cb00d7caf6a522a27</GroupId>\n  <Response>Approved</Response>\n  <AuthCode>P306990</AuthCode>\n  <HostRefNum>703200000390</HostRefNum>\n  <ProcReturnCode>00</ProcReturnCode>\n  <TransId>17032OHXH15476</TransId>\n  <ErrMsg></ErrMsg>\n  <Extra>\n    <SETTLEID>387</SETTLEID>\n    <TRXDATE>20170201 14:07:23</TRXDATE>\n    <ERRORCODE></ERRORCODE>\n    <TERMINALID>00556600</TERMINALID>\n    <MERCHANTID>655000100</MERCHANTID>\n    <CARDBRAND>VISA</CARDBRAND>\n    <CARDISSUER>T. IS BANKASI A.S.</CARDISSUER>\n    <HOSTDATE>0201-140723</HOSTDATE>\n    <NUMCODE>00</NUMCODE>\n  </Extra>\n</CC5Response>\n",
            "is_succeeded": true,
            "amount": "10.94",
            "remote_addr": null,
            "created_date": "2017-02-02T09:40:30.722919Z",
            "pos_slug": "HA",
            "modified_date": "2017-02-05T20:03:17.194881Z"
        }
    ],
    "payment_option": {
        "pk": 2,
        "name": "Credit Card",
        "slug": "credit_Card",
        "payment_type": "credit_card",
        "sort_order": 0,
        "is_active": true,
        "config": {},
        "translations": {
            "tr-tr": {
                "name": "Kredi Kartı"
            }
        },
        "channel": 1,
        "modified_date": "2021-11-10T10:06:41.529791Z",
        "created_date": "2017-02-01T14:46:02.110133Z"
    },
    "payment_option_slug": "kredi_karti",
    "bin_number": "454360",
    "installment": {
        "pk": 22,
        "card": {
            "pk": 23,
            "name": "Maximum",
            "bank": {
                "pk": 16,
                "name": "İş Bankası",
                "slug": "is-bankas",
                "logo": null,
                "channel": 1,
                "modified_date": "2017-02-01T14:34:07.916233Z",
                "created_date": "2017-02-01T14:34:07.916213Z"
            },
            "card_type": {
                "pk": 18,
                "name": "Maximum",
                "slug": "maximum",
                "logo": "http://localhost:8000/media/card_types/2017/02/01/d09bb303-ea29-4eba-8c9a-f9bc056d52d7.jpg",
                "channel": 1,
                "modified_date": "2017-02-01T14:34:08.130132Z",
                "created_date": "2017-02-01T14:34:08.130112Z"
            },
            "card_payment_type": "credit",
            "cash_payment": 10,
            "installment_payment": 2,
            "slug": "maximum",
            "three_d_payment": 10,
            "is_commerce_card": false,
            "channel": 1,
            "modified_date": "2017-02-01T14:34:08.139753Z",
            "created_date": "2017-02-01T14:34:08.139728Z"
        },
        "installment_count": 1,
        "label": "Peşin",
        "interest_rate": "0.000000",
        "is_active": true,
        "config": {},
        "translations": null
    },
    "installment_count": 1,
    "installment_interest_amount": "0.00",
    "cargo_company": {
        "pk": 1,
        "name": "Aras",
        "erp_code": "ARAS",
        "shipping_company": "aras",
        "modified_date": "2018-08-15T12:11:54.402253Z",
        "created_date": "2017-01-30T14:02:18.165573Z"
    },
    "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",
    "cancellation_info": {
        "shipping_refund_amount": "8.50",
        "staff_remote_id": null,
        "refund_amount": "10.94",
        "order_items": [
            {
                "status": "100",
                "pk": 115,
                "reason": 4,
                "previous_status": "450"
            }
        ],
        "previous_status": "450",
        "discounts": [],
        "discount_refund_amount": "0.0",
        "retail_store_remote_id": null,
        "refund_invoice_number": null
    },
    "status_display": "cancellation waiting",
    "tracking_number": "123",
    "is_send": true,
    "cancel_status": "waiting",
    "net_shipping_amount": 8.5,
    "remote_addr": null,
    "language_code": null,
    "fundstransfertransaction_set": [],
    "has_gift_box": false,
    "gift_box_note": null,
    "tracking_url": null,
    "external_status": null,
    "payondeliverytransaction_set": [],
    "loyaltytransaction_set": [],
    "bextransaction_set": [],
    "cancellationplan_set": [
        {
            "pk": 15,
            "order": {
                "pk": 29,
                "number": "4cd342afffef8464",
                "channel": 1,
                "status": "50",
                "date_placed": "2017-02-01T11:07:24.155206Z",
                "customer": 1104,
                "shipping_address": 28,
                "billing_address": 28,
                "currency": "try",
                "amount": "10.94",
                "shipping_amount": "8.50",
                "shipping_tax_rate": null,
                "extra_field": {
                    "cargo_line_id": "9e52cd4f-921a-4680v-aaea-a70f0085f18a"
                },
                "payment_option": 2,
                "payment_option_slug": "kredi_karti",
                "bin_number": "454360",
                "installment": 22,
                "installment_count": 1,
                "delivery_type": null,
                "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": "8.50",
                "shipping_interest_amount": "0.00",
                "tracking_number": "123",
                "carrier_shipping_code": null,
                "remote_addr": null,
                "fundstransfertransaction_set": [],
                "has_gift_box": false,
                "gift_box_note": null,
                "external_status": null,
                "client_type": "default",
                "language_code": null,
                "notes": null,
                "delivery_range": null,
                "shipping_option_slug": null,
                "segment": null,
                "modified_date": "2022-12-20T10:30:46.666779Z",
                "checkout_provider_id": null,
                "created_date": "2017-02-02T09:40:30.624692Z"
            },
            "invoice_number": null,
            "order_previous_status": "450",
            "shipping_refund_amount": "8.50",
            "refund_amount": "10.94",
            "discount_refund_amount": "0.00",
            "status": "waiting",
            "plan_type": "cancel",
            "cancellationplanorderitem_set": [
                {
                    "pk": 13,
                    "order_item": {
                        "pk": 115,
                        "order": {
                            "pk": 29,
                            "number": "4cd342afffe84v64",
                            "channel": 1,
                            "status": "50",
                            "date_placed": "2017-02-01T11:07:24.155206Z",
                            "customer": 1104,
                            "shipping_address": 28,
                            "billing_address": 28,
                            "currency": "try",
                            "amount": "10.94",
                            "shipping_amount": "8.50",
                            "shipping_tax_rate": null,
                            "extra_field": {
                                "cargo_line_id": "9e52cd4f-921a-4f680-aaea-a70f0085f18a"
                            },
                            "payment_option": 2,
                            "payment_option_slug": "kredi_karti",
                            "bin_number": "454360",
                            "installment": 22,
                            "installment_count": 1,
                            "delivery_type": null,
                            "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": "8.50",
                            "shipping_interest_amount": "0.00",
                            "tracking_number": "123",
                            "carrier_shipping_code": null,
                            "remote_addr": null,
                            "fundstransfertransaction_set": [],
                            "has_gift_box": false,
                            "gift_box_note": null,
                            "external_status": null,
                            "client_type": "default",
                            "language_code": null,
                            "notes": null,
                            "delivery_range": null,
                            "shipping_option_slug": null,
                            "segment": null,
                            "modified_date": "2022-12-20T10:30:46.666779Z",
                            "checkout_provider_id": null,
                            "created_date": "2017-02-02T09:40:30.624692Z"
                        },
                        "product": {
                            "pk": 5957,
                            "name": "Limon",
                            "base_code": "1KMEYV0011",
                            "sku": "2672881053987",
                            "product_type": "0",
                            "is_active": true,
                            "parent": null,
                            "attributes": {
                                "erp_ProductAtt15Desc": "%50+%50 PROMOSYON",
                                "erp_ProductCode": "1KMEYV0011108",
                                "integration_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                                "erp_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                                "uretim_yeri": "ÇİN",
                                "renk": "SARI",
                                "integration_ProductAtt03Desc": "2011/2012 KIŞ",
                                "erp_ProductAtt07Desc": "50+50 promosyon",
                                "erp_color": "SARI",
                                "erp_ProductAtt01Desc": "DIŞ ALIM",
                                "materyal": "POLYFOAM",
                                "integration_ProductCode": "1KMEYV0011108",
                                "integration_ProductAtt01Desc": "DIŞ ALIM",
                                "erp_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                                "erp_ProductHierarchyLevel02": "Dekoratif",
                                "integration_ProductAtt05Desc": "%50+%20 OUTLET PROMOSYONU",
                                "erp_ProductAtt03Desc": "2011/2012 KIŞ",
                                "erp_ProductAtt02Desc": "Yapay Meyve",
                                "integration_ProductAtt15Desc": "%50+%50 PROMOSYON",
                                "integration_ProductHierarchyLevel01": "TEKSTİL DIŞI",
                                "integration_ProductHierarchyLevel02": "Dekoratif",
                                "erp_ProductAtt25Desc": "ÇİN",
                                "erp_ProductAtt12Desc": "%50 + %20 PROMOSYON",
                                "erp_ProductAtt20Desc": "POLYFOAM",
                                "integration_ProductAtt02Desc": "Yapay Meyve",
                                "integration_ProductAtt07Desc": "50+50 promosyon",
                                "filtre_renk1": "Sarı"
                            },
                            "attributes_kwargs": {
                                "erp_ProductHierarchyLevel01": {
                                    "value": "TEKSTİL DIŞI",
                                    "data_type": "dropdown",
                                    "label": "TEKSTİL DIŞI"
                                },
                                "erp_ProductHierarchyLevel02": {
                                    "value": "Dekoratif",
                                    "data_type": "dropdown",
                                    "label": "Dekoratif"
                                },
                                "filtre_renk1": {
                                    "value": "Sarı",
                                    "data_type": "dropdown",
                                    "label": "Sarı"
                                },
                                "erp_color": {
                                    "value": "SARI",
                                    "data_type": "dropdown",
                                    "label": "SARI"
                                },
                                "integration_ProductHierarchyLevel01": {
                                    "value": "TEKSTİL DIŞI",
                                    "data_type": "dropdown",
                                    "label": "TEKSTİL DIŞI"
                                },
                                "integration_ProductHierarchyLevel02": {
                                    "value": "Dekoratif",
                                    "data_type": "dropdown",
                                    "label": "Dekoratif"
                                },
                                "renk": {
                                    "value": "SARI",
                                    "data_type": "dropdown",
                                    "label": "SARI"
                                }
                            },
                            "extra_attributes": {},
                            "group_products": [],
                            "productimage_set": [
                                {
                                    "pk": 17180,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/d907e2f2-b615-454c-a383-ca1ae7e93faf.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.574308Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                },
                                {
                                    "pk": 17181,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/982815c2-ae3e-4cb1-b126-93ab2622b57c.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.640015Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                },
                                {
                                    "pk": 17182,
                                    "status": "active",
                                    "image": "http://localhost:8000/media/products/2017/01/23/5957/c1bb563c-b2bd-4478-99ab-cc5136d55a84.jpg",
                                    "order": 0,
                                    "created_date": "2017-01-23T15:26:39.704360Z",
                                    "specialimage_set": [],
                                    "modified_date": "2021-11-03T10:04:57.786718Z"
                                }
                            ],
                            "attribute_set": 66,
                            "custom_attribute_set": null,
                            "productization_date": "2017-01-23T17:42:56.863166Z",
                            "listing_code": null,
                            "data_source": null,
                            "modified_date": "2021-02-23T13:45:37.864572Z",
                            "uuid": "2e200443-b5ea-4909-b75f-02912fc9e4cd",
                            "created_date": "2017-01-22T22:20:51.092944Z"
                        },
                        "status": "50",
                        "price_currency": "try",
                        "price": "2.44",
                        "tax_rate": "18.00",
                        "extra_field": {},
                        "price_list": {
                            "pk": 1,
                            "name": "default_price_list",
                            "code": "default_price_list",
                            "is_auto_sync": true,
                            "modified_date": "2017-01-22T12:14:44.637000Z",
                            "created_date": "2017-01-22T12:14:44.637000Z",
                            "currency": "try"
                        },
                        "stock_list": {
                            "pk": 1,
                            "name": "default_stock_list",
                            "code": "default_stock_list",
                            "is_auto_sync": true,
                            "modified_date": "2017-01-22T12:14:18.030000Z",
                            "created_date": "2017-01-22T12:14:18.030000Z"
                        },
                        "invoice_number": null,
                        "invoice_date": null,
                        "e_archive_url": null,
                        "cancel_status": "waiting",
                        "status_display": "cancellation waiting",
                        "installment_interest_amount": "0.00",
                        "net_amount": "2.44",
                        "tracking_number": "123",
                        "shipping_company": null,
                        "discount_amount": "0.00",
                        "shipment_code": null,
                        "benefitapplicant_set": [],
                        "external_status": null,
                        "retail_price": null,
                        "attributes": {},
                        "attributes_kwargs": {},
                        "tracking_url": null,
                        "image": null,
                        "parent": null,
                        "data_source": null,
                        "estimated_delivery_date": null,
                        "datasource": null
                    },
                    "order_item_previous_status": "450",
                    "status": "100",
                    "reason": {
                        "pk": 4,
                        "cancellation_type": "cancel",
                        "extra_information_needed": true,
                        "order": 100,
                        "subject": "Other",
                        "is_active": true,
                        "send_to_remote": false,
                        "modified_date": "2021-10-01T13:19:06.985243Z",
                        "created_date": "2018-08-15T12:11:54.817442Z"
                    },
                    "modified_date": "2022-12-20T10:30:46.696440Z"
                }
            ],
            "created_date": "2022-12-20T10:30:46.688582Z",
            "retail_store_remote_id": null,
            "staff_remote_id": null,
            "created_by": {
                "pk": 1,
                "username": "admin",
                "first_name": "John",
                "last_name": "Doe",
                "email": "samplemail@akinon.com",
                "is_staff": true,
                "is_active": true,
                "date_joined": "2017-01-22T21:29:29.531432Z",
                "last_login": "2022-12-20T07:31:18.656960Z",
                "is_superuser": true,
                "groups": [
                    1,
                    2
                ]
            },
            "modified_date": "2022-12-20T10:30:46.688608Z",
            "last_updated_by": {
                "pk": 1,
                "username": "admin",
                "first_name": "John",
                "last_name": "Doe",
                "email": "samplemail@akinon.com",
                "is_staff": true,
                "is_active": true,
                "date_joined": "2017-01-22T21:29:29.531432Z",
                "last_login": "2022-12-20T07:31:18.656960Z",
                "is_superuser": true,
                "groups": [
                    1,
                    2
                ]
            }
        }
    ],
    "cashregistertransaction_set": [],
    "client_type": "default",
    "shipping_interest_amount": "0.00",
    "delivery_type": null,
    "notes": null,
    "delivery_range": null,
    "shipping_option_slug": null,
    "segment": null,
    "carrier_shipping_code": null
}
```

**Example Clear Response**

If the user doesn't need any details about the order, they can send “return\_details”: false in the request to operate cancellation. Example response is shown below.

```json

{
    "success": true
}
```

**Example Bad Response**

Expected response status codes are greater than/equal to 400 less than 500. Returns the reason why it is not an acceptable request. Bad Responses are listed below:

```json
{
    "non_field_errors": 'Order cancel_status cannot be updated from approved to confirmed 
                         and waiting_for_payment to less than waiting_for_payment'
    "error_code": 'order_101_4',
}
```

```json
{
    "non_field_errors": 'Strategy not found'
    "error_code": 'cancel_101',
}
```

```json
{
    "non_field_errors": 'Transaction not found'
    "error_code": 'cancel_102',
}
```

```json
{
    "non_field_errors": 'There is no refundable amount'
    "error_code": 'cancel_103',
}
```

```json
{
    "non_field_errors": 'The refund must be done manually input'
    "error_code": 'cancel_104',
}
```

```json
{
    "non_field_errors": 'The count of items does not match the "cancel_items" count.'
    "error_code": 'cancel_105',
}
```

```json
{
    "non_field_errors": 'Forced refund amount not valid'
    "error_code": 'cancel_106',
}
```

```json
{
    "non_field_errors": 'There can not be more than one active cancellation request'
    "error_code": 'cancel_107',
}
```

```json
{
    "non_field_errors": 'Cant create CancellationRequest for already cancelled items.'
    "error_code": 'cancel_108',
}
```

```json
{
    "non_field_errors": 'You must make cancellation and refund requests separately'
    "error_code": 'cancel_109',
}
```

```json
{
    "non_field_errors": 'The amount to be refunded can not be 0. order_id: {0}'
    "error_code": 'cancel_111',
}
```

```json
{
    "non_field_errors": 'Can not update to '{0}' status'
    "error_code": 'cancel_112',
}
```

```json
{
    "non_field_errors": 'Unreported order of ERP can not be canceled'
    "error_code": 'cancel_113',
}
```

```json
{
    "non_field_errors": 'Refund amount greater than order amount'
    "error_code": 'cancel_114',
}
```

```json
{
    "non_field_errors": 'The refund must be selected all order items. Missing order items: {0}'
    "error_code": 'cancel_115',
}
```

```json
{
    "non_field_errors": 'Order({0})'s refund amount({1}) doesn't equal to CancellationPlan's refund amount({2})'
    "error_code": 'cancel_116',
}
```

```json
{
    "non_field_errors": 'Following parameters can not be used together: {0}'
    "error_code": 'cancel_117',
}
```

```json
{
    "non_field_errors": 'Cancellation reason missing for item with ID: {0}.'
    "error_code": 'cancel_118',
}
```

```json
{
    "non_field_errors": 'Orders that have multi-status items can not be canceled within pay-on-delivery.'
    "error_code": 'cancel_119',
}
```

```json
{
    "non_field_errors": 'Multiple data-sources found for the given items.'
    "error_code": 'cancel_120',
}
```


# Cancellation & Refund Pending Orders

Orders pending cancellation, return confirmation (LIST):

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">Cancel & Refund Pending Orders</mark>

**Path:** `/api/i1/orders/?limit=10&page=1&cancel_status=waiting`

Sample HTTP request to retrieve only cancellation and refund pending orders.

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

**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 = {
   'cancel_status: 'waiting',
   'limit': 10,
   'page': 1,
}

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

**Example Response**

Shows desired orders. All parameters of an order are described in the table below.

<table data-header-hidden><thead><tr><th width="157.38671875"></th><th width="133.65625"></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)<br>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>

```json
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 32,
            "number": "d4d10357bbf314b0",
            "status": "450",
            "date_placed": "2017-02-01T14:45:47.033367Z",
            "customer": {
                "id": 1104,
                "email": "samplemail@akinon.com",
                "first_name": "John",
                "last_name": "Doe",
                "phone_number": null
            },
            "shipping_address": {
                "email": "samplemail@akinon.com",
                "phone_number": "9999999999",
                "first_name": "John",
                "last_name": "Doe",
                "country": {
                    "name": "Turkey",
                    "code": "tr"
                },
                "city": {
                    "id": 62,
                    "name": "İstanbul"
                },
                "line": "line",
                "title": "title",
                "township": {
                    "id": 156,
                    "name": "SARIYER"
                },
                "district": null,
                "postcode": "31213",
                "notes": null,
                "company_name": null,
                "tax_office": null,
                "tax_no": null,
                "e_bill_taxpayer": false,
                "identity_number": null,
                "extra_field": {}
            },
            "billing_address": {
                "email": "samplemail@akinon.com",
                "phone_number": "9999999999",
                "first_name": "John",
                "last_name": "Doe",
                "country": {
                    "name": "Turkey",
                    "code": "tr"
                },
                "city": {
                    "id": 62,
                    "name": "İstanbul"
                },
                "line": "line",
                "title": "title",
                "township": {
                    "id": 156,
                    "name": "SARIYER"
                },
                "district": null,
                "postcode": "31213",
                "notes": null,
                "company_name": null,
                "tax_office": null,
                "tax_no": null,
                "e_bill_taxpayer": false,
                "identity_number": null,
                "extra_field": {}
            },
            "currency": "try",
            "amount": "11.40",
            "shipping_amount": "8.50",
            "shipping_tax_rate": null,
            "extra_field": {
                "cargo_line_id": "a55a2b33-434f-4cb6-b369-a70f00860df1"
            },
            "payment_option": 2,
            "payment_option_slug": "kredi_karti",
            "bin_number": "454360",
            "installment": 22,
            "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": "8.50",
            "shipping_interest_amount": "0.00",
            "tracking_number": null,
            "carrier_shipping_code": null,
            "remote_addr": null,
            "has_gift_box": false,
            "gift_box_note": null,
            "external_status": null,
            "orderitem_set": [
                {
                    "id": 118,
                    "order": 32,
                    "product_sku": "2672881094195",
                    "status": "450",
                    "price_currency": "try",
                    "price": "2.90",
                    "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": null,
                    "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": "http://localhost:8080/api/v1/"
                }
            }
        },
        {
            "id": 33,
            "number": "95d4deb15760461",
            "status": "50",
            "date_placed": "2017-02-02T11:06:57.973468Z",
            "customer": {
                "id": 1105,
                "email": "samplemail@akinon.com",
                "first_name": "John",
                "last_name": "Doe",
                "phone_number": null
            },
            "shipping_address": {
                "email": "samplemail@akinon.com",
                "phone_number": "9999999999",
                "first_name": "Akinon",
                "last_name": "Şirket",
                "country": {
                    "name": "Turkey",
                    "code": "tr"
                },
                "city": {
                    "id": 65,
                    "name": "Adıyaman"
                },
                "line": "line",
                "title": "Adres Ev",
                "township": {
                    "id": 576,
                    "name": "ÇELİKHAN"
                },
                "district": {
                    "id": 3993,
                    "name": "MERKEZ"
                },
                "postcode": "34170",
                "notes": null,
                "company_name": null,
                "tax_office": null,
                "tax_no": null,
                "e_bill_taxpayer": false,
                "identity_number": null,
                "extra_field": {}
            },
            "billing_address": {
                "email": "samplemail@akinon.com",
                "phone_number": "9999999999",
                "first_name": "Akinon",
                "last_name": "Şirket",
                "country": {
                    "name": "Turkey",
                    "code": "tr"
                },
                "city": {
                    "id": 65,
                    "name": "Adıyaman"
                },
                "line": "line",
                "title": "Adres Ev",
                "township": {
                    "id": 576,
                    "name": "ÇELİKHAN"
                },
                "district": {
                    "id": 3993,
                    "name": "MERKEZ"
                },
                "postcode": "34170",
                "notes": null,
                "company_name": null,
                "tax_office": null,
                "tax_no": null,
                "e_bill_taxpayer": false,
                "identity_number": null,
                "extra_field": {}
            },
            "currency": "try",
            "amount": "33.22",
            "shipping_amount": "8.50",
            "shipping_tax_rate": null,
            "extra_field": {
                "cargo_line_id": "33c7d761-0b65-451d-bbbf-a70f00860fdb"
            },
            "payment_option": 2,
            "payment_option_slug": "kredi_karti",
            "bin_number": "454359",
            "installment": 22,
            "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": "8.50",
            "shipping_interest_amount": "0.00",
            "tracking_number": null,
            "carrier_shipping_code": null,
            "remote_addr": null,
            "has_gift_box": false,
            "gift_box_note": null,
            "external_status": null,
            "orderitem_set": [
                {
                    "id": 119,
                    "order": 33,
                    "product_sku": "2672880307807",
                    "status": "50",
                    "price_currency": "try",
                    "price": "24.72",
                    "tax_rate": "18.00",
                    "extra_field": {},
                    "price_list": 1,
                    "stock_list": 1,
                    "cancel_status": "waiting",
                    "invoice_number": null,
                    "invoice_date": null,
                    "e_archive_url": null,
                    "installment_interest_amount": "0.00",
                    "tracking_number": null,
                    "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": "http://localhost:8080/api/v1/"
                }
            }
        }
    ]
}

```


# Order Discount Items

Any discounts for an order are held in the Discount Item table in the Omnitron.

In the `api/v1/discount_items/detailed_integration/?order={order_id}` response, `discount_items`, that is, the discounted items, are shown in the result list.

If it is desired to return details for a single item in the result list, a request can be sent to `/api/v1/discount_items/{discountitem_id}/detailed_integration`. The response from this endpoint will show the details of the discount item id instead of `{discountitem_id}.`

Detailed information about the order discount is shown in the table below.

<table data-header-hidden><thead><tr><th width="137.578125"></th><th width="114.1796875"></th><th width="106.8828125"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>{order_id}</td><td>string</td><td>query</td><td>Order ID</td></tr></tbody></table>

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">Order Discount Items</mark>

**Path:** `api/v1/discount_items/detailed_integration/?order={order_id}`

Sample HTTP request to retrieve all discount items related to an order.

* `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/v1/discount_items/detailed_integration/?order={order_id}"

api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response**

Shows desired discount items. All parameters of a discount item are described in the table below.

**Benefit Applicant Set**

It is the table that establishes the relationship between the discount item and the order item.

<table data-header-hidden><thead><tr><th width="170.546875"></th><th width="108.8046875"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>pk</td><td>integer</td><td>discount item's ID</td></tr><tr><td>name</td><td>text</td><td>discount name</td></tr><tr><td>amount</td><td>decimal</td><td>discount amount</td></tr><tr><td>order</td><td>integer</td><td>order pk</td></tr><tr><td>offer_type</td><td>enum</td><td>discount type</td></tr><tr><td>session_offer_type</td><td>enum</td><td>session offer type</td></tr><tr><td>code</td><td>text</td><td>coupon code (if applicable)</td></tr><tr><td>benefitapplicant_set</td><td>dict</td><td>order items with discount</td></tr><tr><td>promotion</td><td>dict</td><td>implemented campaign</td></tr><tr><td>conditionapplicant_set</td><td>dict</td><td>order_items with discount</td></tr></tbody></table>

**Promotion**

Related promotion object in the order.

<table data-header-hidden><thead><tr><th width="157.5703125"></th><th width="125.42578125"></th><th></th></tr></thead><tbody><tr><td><strong>Key</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>pk</td><td>integer</td><td>promotion ID</td></tr><tr><td>created_date</td><td>date</td><td>created date</td></tr><tr><td>modified_date</td><td>date</td><td>modified date</td></tr><tr><td>name</td><td>text</td><td>campaign name</td></tr><tr><td>slug</td><td>text</td><td>campaign slug</td></tr></tbody></table>

```json
 {
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "pk": 10,
            "name": "3 al 2 Öde",
            "amount": "199.90",
            "order": 202,
            "offer_type": "basket_offer",
            "session_offer_type": null,
            "code": null,
            "modified_date": "2021-05-11T06:42:55.684412Z",
            "promotion": {
                "id": 1,
                "created_date": "2021-02-23T10:42:04.864679Z",
                "modified_date": "2021-02-23T10:42:04.864699Z",
                "name": "3 al 2 Öde",
                "slug": "3-al-2-ode"
            },
            "created_date": "2021-05-11T06:42:55.684393Z",
            "benefitapplicant_set": [
                {
                    "id": 16,
                    "created_date": "2021-05-11T06:42:55.694486Z",
                    "modified_date": "2021-05-11T06:42:55.721790Z",
                    "discount_share": "66.63",
                    "discount_item": 10,
                    "order_item": 414
                },
                {
                    "id": 17,
                    "created_date": "2021-05-11T06:42:55.700152Z",
                    "modified_date": "2021-05-11T06:42:55.727783Z",
                    "discount_share": "66.63",
                    "discount_item": 10,
                    "order_item": 415
                },
                {
                    "id": 18,
                    "created_date": "2021-05-11T06:42:55.706338Z",
                    "modified_date": "2021-05-11T06:42:55.732994Z",
                    "discount_share": "66.64",
                    "discount_item": 10,
                    "order_item": 416
                }
            ],
            "conditionapplicant_set": []
        }
    ]
}
```


# Order Status Codes & Cancellation Statuses

## <mark style="color:red;">Order Status Codes</mark>

In the system, various order statuses are used to track the progress and management of orders from placement to delivery and beyond. Each status code represents a specific stage in the order processing workflow, helping both customers and merchants understand the current state of an order.

Below is a comprehensive table detailing each status code, its numerical identifier, and a description of what each status signifies.

<table data-header-hidden><thead><tr><th width="100.4296875"></th><th width="180.80859375"></th><th></th></tr></thead><tbody><tr><td><strong>Code</strong></td><td><strong>Status</strong></td><td><strong>Description</strong></td></tr><tr><td>50</td><td>cancellation_waiting</td><td>The cancellation request is pending and awaiting approval. The order remains in this status until a decision is made regarding its cancellation.</td></tr><tr><td>100</td><td>canceled</td><td>The order has been canceled. The order has been removed from processing, and the product will not be delivered.</td></tr><tr><td>200</td><td>waiting</td><td>The order is currently pending and awaiting processing. Necessary steps for order fulfillment have not yet been completed.</td></tr><tr><td>300</td><td>payment_waiting</td><td>Payment is awaited. The order is on hold until the customer completes the payment process.</td></tr><tr><td>350</td><td>confirmation_waiting</td><td>Order confirmation is pending. The order will remain in this status until confirmation is received from the customer or relevant system.</td></tr><tr><td>400</td><td>approved</td><td>The order has been approved. It has been validated and is ready to proceed to the next stage of processing.</td></tr><tr><td>450</td><td>preparing</td><td>The order is being prepared for shipment. This includes packaging and other pre-shipment activities.</td></tr><tr><td>500</td><td>shipped</td><td>The order has been shipped and is on its way to the customer.</td></tr><tr><td>510</td><td>shipped_and_informed</td><td>The order has been shipped and the customer has been informed about the shipment status.</td></tr><tr><td>520</td><td>ready_for_pickup</td><td>The order is ready for pickup by the customer at a designated location.</td></tr><tr><td>540</td><td>attempted_delivery</td><td>An attempt to deliver the order has been made but was unsuccessful. Further action may be required to complete the delivery.</td></tr><tr><td>544</td><td>review_started</td><td>The review process for the order has begun. This may involve checking the order details or processing feedback.</td></tr><tr><td>545</td><td>review_waiting</td><td>The order is waiting for review. This status indicates that the order is under examination or approval before further processing.</td></tr><tr><td>546</td><td>waiting_for_payment (trade-in only)</td><td>Payment is awaited for trade-in transactions. The order will remain in this status until the payment is completed.</td></tr><tr><td>547</td><td>paid (trade-in only)</td><td>Payment for the trade-in transaction has been completed. The order can now proceed to the next steps.</td></tr><tr><td>550</td><td>delivered</td><td>The order has been successfully delivered to the customer.</td></tr><tr><td>600</td><td>refunded</td><td>The order has been refunded. The customer has been reimbursed, and the transaction has been reversed.</td></tr></tbody></table>

## <mark style="color:red;">Order Cancel Statuses</mark>

In addition, the system also tracks the progress of `cancel_status`. These statuses represent specific stages in the cancellation process for each order or each order item, helping both customers and merchants understand the current state of a cancellation.

Below is a detailed table of cancel statuses and descriptions:

<table><thead><tr><th width="209.45703125">Status</th><th>Description</th></tr></thead><tbody><tr><td>waiting</td><td>The cancellation request has been received but is currently pending and requires no immediate action. This status indicates that the request is in the queue to be processed.</td></tr><tr><td>confirmation_waiting</td><td>The cancellation request is awaiting confirmation from the customer or a related party. The process will not proceed further until confirmation is provided.</td></tr><tr><td>confirmed</td><td>The cancellation request has been confirmed by all necessary parties. It is now ready to proceed to the next steps, such as approval or refund processing.</td></tr><tr><td>approved</td><td>The cancellation request has been reviewed and approved. The process will now move forward, such as issuing a refund or updating the order status to canceled.</td></tr><tr><td>rejected</td><td>The cancellation request has been reviewed and rejected. This status indicates that the cancellation will not proceed, and the order remains active.</td></tr><tr><td>waiting_for_payment</td><td>The cancellation process is on hold as it requires payment completion to proceed, particularly in cases involving refunds or other financial transactions.</td></tr><tr><td>manuel_refund_need</td><td>The cancellation requires manual intervention to process the refund. This status typically involves cases where the system cannot automatically handle the refund due to specific conditions.</td></tr><tr><td>completed</td><td>The cancellation process has been successfully finalized. All associated actions, such as refunds or updates to the order status, have been completed.</td></tr></tbody></table>

## <mark style="color:red;">Order Cancellation Request Statuses</mark>

In addition to the standard order statuses, the system also tracks the progress of order cancellation requests through various statuses. These statuses represent specific stages in the cancellation process, helping both customers and merchants understand the current state of a cancellation request.

Below is a detailed table of cancellation request statuses and descriptions:

<table><thead><tr><th width="195.0546875">Status</th><th>Description</th></tr></thead><tbody><tr><td>open</td><td>The cancellation request has been created and is in the initial stage. No further actions have been taken yet.</td></tr><tr><td>waiting</td><td>The cancellation request has been received but is currently pending and requires no immediate action. This status indicates that the request is in the queue to be processed.</td></tr><tr><td>confirmation_waiting</td><td>The cancellation request is awaiting confirmation from the customer or a related party. The process will not proceed further until confirmation is provided.</td></tr><tr><td>confirmed</td><td>The cancellation request has been confirmed by all necessary parties. It is now ready to proceed to the next steps, such as approval or refund processing.</td></tr><tr><td>waiting_approval</td><td>The cancellation request is awaiting approval from a responsible team or system. This stage typically involves validation or review of the request before finalizing the cancellation.</td></tr><tr><td>approved</td><td>The cancellation request has been reviewed and approved. The process will now move forward, such as issuing a refund or updating the order status to canceled.</td></tr><tr><td>rejected</td><td>The cancellation request has been reviewed and rejected. This status indicates that the cancellation will not proceed, and the order remains active.</td></tr><tr><td>waiting_for_payment</td><td>The cancellation process is on hold as it requires payment completion to proceed, particularly in cases involving refunds or other financial transactions.</td></tr><tr><td>manuel_refund_need</td><td>The cancellation requires manual intervention to process the refund. This status typically involves cases where the system cannot automatically handle the refund due to specific conditions.</td></tr><tr><td>completed</td><td>The cancellation process has been successfully finalized. All associated actions, such as refunds or updates to the order status, have been completed.</td></tr></tbody></table>


# Migration


# Getting Started

## <mark style="color:red;">General Flow</mark>

* The User, Address, Order, and Order Item information to be migrated is obtained.
* A test User, Address, Order, and Order Item are prepared each.
* Knowledge of the User's password is required.
* Test migration is performed for the User.
* Test migration is performed for Address.
* Test migration is performed for Order.
* Test migration is performed for Order Item.
* Once the tests are successful, the real migration is performed in the same order.

## <mark style="color:red;">Migration Flow Control</mark>

### **Recommended Checklist**

* The User, Address, Order, and Order Item should be migrated in sequence. The progress of each migration\_id received with each request should be monitored. If error\_count:1 is received, before proceeding to the next step, the formats of the data in the sent JSON should be checked.
* After completing the Order Item migration, login should be performed with the credentials of the migrated User.
* On the "My Addresses" page, the arrival of the address should be confirmed at `/account/address/`.
* In the "My Past Orders" page, it should be verified that the migrated order is at `/users/old-orders/`, and the order items are at `/users/old-orders/{pk}`.
* If the testing process is successful, real data should be migrated.

{% hint style="warning" %}
Detailed logs of errors encountered during the migration process are not currently being maintained. Therefore, in the script you'll be writing, we recommend logging each request along with the sent data. This way, in case of any potential errors, you'll be able to debug using the data you've sent.
{% endhint %}


# User Migration

* If user passwords in the old system are encrypted using MD5, SHA1, or SHA256, you can migrate users using these algorithms.
* Otherwise, after users are migrated, they must create a new password using the **Forgot Password** option during their first login. In this case, get in touch with the Akinon team to receive assistance regarding the password\_algorithm value to be used in the upcoming steps.
* Migrated users can be checked in the omnitron panel under **Sales Channel > Users** section.
* Unencrypted credentials of the test user undergoing migration will be needed for future checks.
* The user being imported must not have a record in Omnitron. The email field must be unique.

## <mark style="color:red;">Commerce ENV Settings</mark>

If the encryption algorithm is "md5," then the PASSWORD\_HASHERS list in the ENV should be updated as follows:

```

PASSWORD_HASHERS='django.contrib.auth.hashers.PBKDF2PasswordHasher','django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher','django.contrib.auth.hashers.Argon2PasswordHasher','django.contrib.auth.hashers.BCryptSHA256PasswordHasher','django.contrib.auth.hashers.BCryptPasswordHasher','django.contrib.auth.hashers.MD5PasswordHasher','django.contrib.auth.hashers.UnsaltedMD5PasswordHasher'

```

If the encryption algorithm is "sha1," then the PASSWORD\_HASHERS list in the ENV should be updated as follows:

```

PASSWORD_HASHERS='django.contrib.auth.hashers.PBKDF2PasswordHasher','django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher','django.contrib.auth.hashers.Argon2PasswordHasher','django.contrib.auth.hashers.BCryptSHA256PasswordHasher','django.contrib.auth.hashers.BCryptPasswordHasher','omnishop.users.helpers.SHA1MD5PasswordHasher','django.contrib.auth.hashers.SHA1PasswordHasher', ‘django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher'

```

If the encryption algorithm is "sha256," then the PASSWORD\_HASHERS list in the ENV should be updated as follows:

```

PASSWORD_HASHERS='django.contrib.auth.hashers.PBKDF2PasswordHasher','django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher','django.contrib.auth.hashers.Argon2PasswordHasher','django.contrib.auth.hashers.BCryptSHA256PasswordHasher','django.contrib.auth.hashers.BCryptPasswordHasher','omnishop.users.helpers.SHA256PasswordHasher', ‘omnishop.users.helpers.SHA256UnsaltedPasswordHasher'

```

### Example Request

```
curl --location --request POST 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/start/user/' \
--header 'Authorization: Token {{token}}' \
--form 'file=@"/path/to/test_user.json"'

```

#### **Test User File Format (test\_user.json)**

```json
[
    {
        "first_name": "Lorem",
        "last_name": "Ipsum",
        "email": "lorem.ipsum@mail.com",
        "gender": "male",
        "sms_allowed": false,
        "email_allowed": false,
        "phone": "999999999",
        "date_of_birth": "1990-01-13",
        "date_joined": "2022-01-13 09:26:00",
        "password": "sha1$salt$7c4a8d09ca3762af61e59520943ddc26494f8941b",
        "password_algorithm": "sha1",
        "customer_code": "1",
        "verified": true,
        "facebook_uuid": null,
        "attributes": {},
        "call_allowed": false,
        "user_type": "registered"
    }
]
```

**Description:**

The data format requirements for each field are as follows:

* **"first\_name"**: Should be in String format and is mandatory.
* **"last\_name"**: Should be in String format and is mandatory.
* **"email"**: Should be in Email format and is mandatory.
* **"gender"**: Should be in String format, can be null or an empty string. Acceptable values are 'male', 'female', or 'not\_to\_say'.
* **"sms\_allowed"**: Should be in Boolean format and is mandatory.
* **"email\_allowed"**: Should be in Boolean format and is mandatory.
* **"phone"**: Should be in the format "5XXXXXXXXX" as a string. Can be null. For foreign numbers, please seek assistance from the Akinon team.
* **"date\_of\_birth"**: Format is detailed in the date\_format section. Can be null.
* **"date\_joined"**: Format is detailed in the datetime\_format section and is mandatory.
* **"password"**: Format is detailed in the password section and is mandatory.
* **"password\_algorithm"**: Should be in String format. Acceptable values are 'sha1', 'md5', or 'sha256'. Mandatory.
* **"customer\_code"**: Should be in String format and is mandatory. After migration, this information will be stored in user.attributes.migration\_customer\_code.
* **"verified"**: Should be in Boolean format and is mandatory.
* **"facebook\_uuid"**: Should be in String format, can be null or an empty string.
* **"attributes"**: Should be in Dictionary format and is mandatory. If empty, it should be provided as {}.
* **"call\_allowed"**: Should be in Boolean format.
* **"user\_type"**: Should be in String format and is mandatory. Acceptable values are 'guest' or 'registered'.

**Date Format:**

The following formats are accepted as date\_format:

* '%Y-%m-%d'
* '%Y/%m/%d'
* '%d.%m.%Y'
* '%d-%m-%Y'
* '%d/%m/%Y'

**Password Format:**

It should be provided in the following format:\
`{algorithm}${salt}${hash_value}`

* **algorithm:** Can be `sha1`, `md5`, or `sha256`.
  * If **no salt** is used, the algorithm value must be set as `unsalted_sha256` instead of `sha256`.
  * Example:

    ```json
    "password": "unsalted_sha256$$02368e229cacd51bdd9c0284744dc049e7f1de06f0fd42529a98c931b5cd59a0",
    "password_algorithm": "sha256"
    ```
* **salt:** If unsalted, should be left empty.
* **hash\_value:** The hash value.

### Example Response

When a request is made using cURL, the response received will be as follows:

```
{"migration_id": "2740e84efe2e4bea91615f46f567aa3c"}
```

#### **Control**

For verification, the following request is sent:

```
curl --location --request GET 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/{{migration_id}}/progress/' \  
--header 'Authorization: Token {{token}}'
```

If the response received is as follows:

```
{
    "total_count": 1,
    "error_count": 0,
    "processed_count": 1
}
```

The response means that the user has been successfully migrated.

#### **Checking Migration Errors**

If the `error_count` value in the progress response is greater than 0, the details of the failed records can be retrieved with the following request:

```
curl --location --request GET 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/{{migration_id}}/errors/' \
--header 'Authorization: Token {{token}}'
```

If there are no errors, the response is returned as follows:

```json
{
    "errors": []
}
```

Otherwise, the `errors` list contains an entry for each failed record, explaining the reason for the failure.

### Migrating Users Without a Phone Number

By default, the `phone` field is required: a record whose `phone` value is null is rejected and reported as an error. Two optional parameters change this behaviour, and they are sent together with the file as a `params` form field in JSON format:

* **`allow_empty_phone`**: When `true`, records with no phone number are migrated with an empty `phone` value.
* **`default_phone`**: A phone number that is written to every record that has no phone number of its own. Records that already contain a phone number are not affected.

```
curl --location --request POST 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/start/user/' \
--header 'Authorization: Token {{token}}' \
--form 'file=@"/path/to/test_user.json"' \
--form 'params={"allow_empty_phone": true, "default_phone": "5555555555"}'
```

**How the two parameters interact:**

`allow_empty_phone` takes precedence over `default_phone`. For a record with no phone number, the outcome is as follows:

| `allow_empty_phone` | `default_phone` | Result                                                           |
| ------------------- | --------------- | ---------------------------------------------------------------- |
| `true`              | any             | The user is migrated with an empty `phone`.                      |
| not sent / `false`  | provided        | The user is migrated with `default_phone` as their phone number. |
| not sent / `false`  | not sent        | The record is rejected and counted as an error.                  |

Choose `allow_empty_phone` when the old system genuinely has no phone data and the empty value should be preserved, so that users can add their own number later. Choose `default_phone` when a phone number is required downstream and a shared placeholder value is acceptable; keep in mind that this placeholder is stored on every such user, so it should be a value that is clearly not a real customer number.


# Address Migration

Address migrations will result in an error if user migrations have not been performed beforehand.

### Example Request

```
curl --location --request POST 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/start/address/' \
--header 'Authorization: Token {{token}}' \
--form 'file=@"/path/to/test_address.json"'
```

#### **Test Address File Format (test\_address.json)**

```
[
    {
        "title": “test”,
        "phone_number": "9999999999",
        "customer_code": "1",
        "first_name": "Lorem",
        "last_name": "Ipsum",
        "township": "ÜSKÜDAR",
        "tax_no": null,
        "country": "Türkiye",
        "company_name": null,
        "city": "İSTANBUL",
        "tax_office": null,
        "line": "A Mh., B Caddesi, C Apt., No 1/2 34000 Üsküdar/İstanbul",
        "email": "lorem.ipsum@mail.com",
        "district": null
    }
]
```

**Description:**

The data format requirements for each field in the context of address migration are as follows:

* **"number"**: Should be in String format, mandatory, and limited to 255 characters.
* **"customer\_code"**: Should be in String format, mandatory. Must match the customer\_code from user migration. This matching is how users and orders are correlated in Omnitron.
* **"user\_email"**: Should be in Email format, mandatory.
* **"status"**: Should be in String format, mandatory, limited to 64 characters.
* **"created\_date"**: Should be in the format detailed in the datetime\_format of user migration.
* **"amount"**: Should be in Float format, maximum of 12 digits, accepting 2 digits after the decimal point. Mandatory.
* **"discount\_amount"**: Should be in Float format, maximum of 12 digits, accepting 2 digits after the decimal point. Can be null.
* **"currency"**: Should be in String format, mandatory. Allowable values for the currency field are detailed elsewhere.
* **"payment\_type"**: Should be in String format, limited to 64 characters. Can be null or an empty string.
* **"bank"**: Should be in String format, limited to 64 characters. Can be null or an empty string.
* **"installment\_count"**: Should be in Integer format, with a minimum value of 1.
* **"tracking\_number"**: Should be in String format, mandatory, limited to 64 characters. Can be null or an empty string.
* **"shipping\_company"**: Should be in String format. Allowable values for the shipping\_company field are detailed elsewhere. Can be null.
* **"shipping\_address"**: Should be in String format, mandatory, limited to 512 characters.
* **"billing\_address"**: Should be in String format, mandatory, limited to 512 characters.
* **"extra\_field"**: Should be in Dictionary format. If empty, it should be provided as {}.

#### **Currency Format:**

The following values are accepted for the currency field:

| Code | Description                                                                                                                                                  |
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| AED  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_United_Arab_Emirates.svg/23px-Flag_of_the_United_Arab_Emirates.svg.png) UAE Dirham |
| BGN  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Bulgaria.svg/23px-Flag_of_Bulgaria.svg.png) Bulgarian Lev                              |
| BHD  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Flag_of_Bahrain.svg/23px-Flag_of_Bahrain.svg.png) Bahraini Dinar                               |
| CZK  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_Czech_Republic.svg/23px-Flag_of_the_Czech_Republic.svg.png) Czech Crown            |
| EGP  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Flag_of_Egypt.svg/23px-Flag_of_Egypt.svg.png) Egyptian Pound                                   |
| EUR  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/23px-Flag_of_Europe.svg.png) Euro                                           |
| GBP  | ![](https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/Flag_of_the_United_Kingdom.svg/23px-Flag_of_the_United_Kingdom.svg.png) The British Pound           |
| HUF  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Flag_of_Hungary.svg/23px-Flag_of_Hungary.svg.png) Hungarian Forint                             |
| INR  | ![](https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Flag_of_India.svg/23px-Flag_of_India.svg.png) Indian Rupee                                          |
| IQD  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Flag_of_Iraq.svg/23px-Flag_of_Iraq.svg.png) Iraqi Dinar                                        |
| KWD  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Flag_of_Kuwait.svg/23px-Flag_of_Kuwait.svg.png) Kuwaiti Dinar                                  |
| MAD  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Flag_of_Morocco.svg/23px-Flag_of_Morocco.svg.png) Moroccan Dirham                              |
| NGN  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Flag_of_Nigeria.svg/23px-Flag_of_Nigeria.svg.png) Nigerian Naira                               |
| OMR  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Flag_of_Oman.svg/23px-Flag_of_Oman.svg.png) Omani Rial                                         |
| PLN  | ![](https://upload.wikimedia.org/wikipedia/en/thumb/1/12/Flag_of_Poland.svg/23px-Flag_of_Poland.svg.png) Polish Zloty                                        |
| QAR  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Flag_of_Qatar.svg/23px-Flag_of_Qatar.svg.png) Qatari Riyal                                     |
| RON  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Flag_of_Romania.svg/23px-Flag_of_Romania.svg.png) Romanian Leu                                 |
| RUB  | ![](https://upload.wikimedia.org/wikipedia/en/thumb/f/f3/Flag_of_Russia.svg/23px-Flag_of_Russia.svg.png) Russian Ruble                                       |
| SAR  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Flag_of_Saudi_Arabia.svg/23px-Flag_of_Saudi_Arabia.svg.png) Suudi Arabistan Riyal              |
| TRY  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Flag_of_Turkey.svg/23px-Flag_of_Turkey.svg.png) Turkish Lira                                   |
| UAH  | ![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Flag_of_Ukraine.svg/23px-Flag_of_Ukraine.svg.png) Ukrayna Grivnası                             |
| USD  | ![](https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/20px-Flag_of_the_United_States.svg.png) United States Dollar          |

#### **Shipping Company Format:**

The following values are accepted for the shipping\_company field:

(format: "shipping company": "accepted value")

Example: "ACS Kargo": "acs",

### Example Response

When a request is made, the response received will be as follows:

```
{"migration_id": "2740e84efe2e4bea91615f46f567aa3c"}
```

#### **Control**

For verification, the following request is sent:

```
curl --location --request GET 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/{{migration_id}}/progress/' \  
--header 'Authorization: Token {{token}}'
```

If the response received is as follows:

```json
{
    "total_count": 1,
    "error_count": 0,
    "processed_count": 1
}
```

The response means that the order has been successfully migrated.


# 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.

<table data-header-hidden><thead><tr><th width="129.74609375"></th><th width="102.84765625"></th><th width="97.17578125"></th><th></th></tr></thead><tbody><tr><td><strong>Field Names</strong></td><td><strong>Data Type</strong></td><td><strong>Required</strong></td><td><strong>Descriptions</strong></td></tr><tr><td>number</td><td>string</td><td>true</td><td>Order ID (Max 128 Characters)</td></tr><tr><td>user</td><td>string</td><td>true</td><td>The customer code of the user</td></tr><tr><td>user_email</td><td>string</td><td>true</td><td>The email of the user</td></tr><tr><td>status</td><td>string</td><td>true</td><td>Order status code](/docs/guide/integration/order/order-status)<br>(Max 64 Characters)</td></tr><tr><td>created_date</td><td>date</td><td>true</td><td>The creation date of the order</td></tr><tr><td>amount</td><td>float</td><td>true</td><td>Max digits:12, max decimal place: 2</td></tr><tr><td>discount_amount</td><td>float</td><td>false</td><td>Max digits:12, max decimal place: 2</td></tr><tr><td>currency</td><td>string</td><td>true</td><td>(/docs/guide/integration/migration/migration-property-choices)</td></tr><tr><td>payment_type</td><td>string</td><td>true</td><td>Max 64 characters</td></tr><tr><td>bank</td><td>string</td><td>true</td><td>Max 64 characters</td></tr><tr><td>installment_count</td><td>integer</td><td>false</td><td>Minimum value is 1 if provided</td></tr><tr><td>tracking_number</td><td>string</td><td>true</td><td>Max 64 characters</td></tr><tr><td>shipping_company</td><td>string</td><td>true</td><td>(/docs/guide/integration/migration/migration-property-choices)</td></tr><tr><td>shipping_address</td><td>string</td><td>true</td><td>Max 512 characters</td></tr><tr><td>billing_address</td><td>string</td><td>true</td><td>Max 512 characters</td></tr><tr><td>extra_field</td><td>json</td><td>false</td><td>The extra information that should be kept in the order</td></tr></tbody></table>

***

| **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’s account](/omnitron/getting-started) |
| 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}`

```python

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.

```json
{
  "migration_id": "4d6f7650799f484d875a89adf8d472b8"
}
```


# Old Order Item Migration

Order item migrations will not be successful without completing user and order migrations beforehand. Migrated order items are stored in the database as a distinct model, separate from the Order Item model in Omnitron. As a result, they won't be displayed on the panel. Users can view their complete past orders on this page `{{shop_url}}/users/old-orders/{{pk}}`.

### Example Request

```
curl --location --request POST 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/start/order_item/' \
--header 'Authorization: Token {{token}}' \
--form 'file=@"/path/to/test_order-item.json"'
```

#### **Test Order Item File Format (test\_order-item.json)**

```json
[
  {
    "order_number": "ORD1234",
    "product": "dolor sit amet",
    "sku": "s1k2u30001",
    "quantity": 1,
    "price": 123.90,
    "image_url": "https://testurl.com/test_picture.jpg",
    "extra_field": {}
  }
]
```

**Description:**

Here are the data format requirements for each field in the context of order item migration:

* **"order\_number"**: Should be in String format, mandatory. Must match the "number" field in order migration.
* **"product"**: Should be in String format. Can be null or an empty string. Limited to 256 characters.
* **"sku"**: Should be in String format. Can be null or an empty string. Limited to 128 characters.
* **"quantity"**: Should be in Integer format, mandatory. Can be null. Value must be at least 1.
* **"price"**: Should be in Float format, maximum of 12 digits, accepting 2 digits after the decimal point. Mandatory.
* **"image\_url"**: Should be in URL format, mandatory. Can be null or an empty string.
* **"extra\_field"**: Should be in Dictionary format. If empty, it should be provided as {}.

### Example Response

When a request is made, the response received will be as follows:

```
{"migration_id": "2740e84efe2e4bea91615f46f567aa3c"}
```

#### **Control**

For verification, the following request is sent:

```

curl --location --request GET 'https://{{omnitron_url}}/api/v1/remote/{{channel_id}}/migrations/{{migration_id}}/progress/' \  
--header 'Authorization: Token {{token}}'

```

If the response received is as follows:

```
{
"total_count": 1,
"error_count": 0,
"processed_count": 1
}
```

It means that the order item has been successfully migrated.


# View Migration Progress

This service allows the user to check the status of previously initiated migration processes. With the values specified as parameters in the table below, a request is sent to the defined endpoint by entering the api\_token value for the relevant user and the migration\_id for the relevant migration process to the relevant store channel.

<table data-header-hidden><thead><tr><th width="137.234375"></th><th width="118.83203125"></th><th width="106.09375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>In</strong></td><td><strong>Descriptions</strong></td></tr><tr><td>channel_id</td><td>integer</td><td>url</td><td>The id of the shop channel</td></tr><tr><td>api_token</td><td>string</td><td>header</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>migration_id</td><td>string</td><td>url</td><td>The string that can be retrieved from the response of start migration request</td></tr></tbody></table>

## <mark style="color:red;">`GET`</mark> <mark style="color:red;">View Migration Progress</mark>

**Path:** `/api/i1/remote/{channel_id}/migrations/{migration_id}/progress/`

To check the status of migrations such as user, address, order etc. that have been started before, a “GET” request is sent to the `/api/v1/remote/{channel_id}/migrations/{migration_id}/progress/` endpoint using the parameters given above.

```python
import requests

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

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

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

#### **Example Response**

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

```json
{
  "Processed_count": 1000,
  "Error_count": 0,
  "total_count": 1000
}
```


# Currency Options

<table><thead><tr><th width="305.05859375">Code</th><th>Description</th></tr></thead><tbody><tr><td>AED</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_United_Arab_Emirates.svg/23px-Flag_of_the_United_Arab_Emirates.svg.png" alt=""> UAE Dirham</td></tr><tr><td>BGN</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Bulgaria.svg/23px-Flag_of_Bulgaria.svg.png" alt=""> Bulgarian Lev</td></tr><tr><td>BHD</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Flag_of_Bahrain.svg/23px-Flag_of_Bahrain.svg.png" alt=""> Bahraini Dinar</td></tr><tr><td>CZK</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Flag_of_the_Czech_Republic.svg/23px-Flag_of_the_Czech_Republic.svg.png" alt=""> Czech Crown</td></tr><tr><td>EGP</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Flag_of_Egypt.svg/23px-Flag_of_Egypt.svg.png" alt=""> Egyptian Pound</td></tr><tr><td>EUR</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/23px-Flag_of_Europe.svg.png" alt=""> Euro</td></tr><tr><td>GBP</td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/Flag_of_the_United_Kingdom.svg/23px-Flag_of_the_United_Kingdom.svg.png" alt=""> The British Pound</td></tr><tr><td>HUF</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Flag_of_Hungary.svg/23px-Flag_of_Hungary.svg.png" alt=""> Hungarian Forint</td></tr><tr><td>INR</td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/4/41/Flag_of_India.svg/23px-Flag_of_India.svg.png" alt=""> Indian Rupee</td></tr><tr><td>IQD</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Flag_of_Iraq.svg/23px-Flag_of_Iraq.svg.png" alt=""> Iraqi Dinar</td></tr><tr><td>KWD</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Flag_of_Kuwait.svg/23px-Flag_of_Kuwait.svg.png" alt=""> Kuwaiti Dinar</td></tr><tr><td>MAD</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Flag_of_Morocco.svg/23px-Flag_of_Morocco.svg.png" alt=""> Moroccan Dirham</td></tr><tr><td>NGN</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/Flag_of_Nigeria.svg/23px-Flag_of_Nigeria.svg.png" alt=""> Nigerian Naira</td></tr><tr><td>OMR</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Flag_of_Oman.svg/23px-Flag_of_Oman.svg.png" alt=""> Omani Rial</td></tr><tr><td>PLN</td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/1/12/Flag_of_Poland.svg/23px-Flag_of_Poland.svg.png" alt=""> Polish Zloty</td></tr><tr><td>QAR</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Flag_of_Qatar.svg/23px-Flag_of_Qatar.svg.png" alt=""> Qatari Riyal</td></tr><tr><td>RON</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Flag_of_Romania.svg/23px-Flag_of_Romania.svg.png" alt=""> Romanian Leu</td></tr><tr><td>RUB</td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/f/f3/Flag_of_Russia.svg/23px-Flag_of_Russia.svg.png" alt=""> Russian Ruble</td></tr><tr><td>SAR</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Flag_of_Saudi_Arabia.svg/23px-Flag_of_Saudi_Arabia.svg.png" alt=""> Suudi Arabistan Riyal</td></tr><tr><td>TRY</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Flag_of_Turkey.svg/23px-Flag_of_Turkey.svg.png" alt=""> Turkish Lira</td></tr><tr><td>UAH</td><td><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Flag_of_Ukraine.svg/23px-Flag_of_Ukraine.svg.png" alt=""> Ukrayna Grivnası</td></tr><tr><td>USD</td><td><img src="https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/20px-Flag_of_the_United_States.svg.png" alt=""> United States Dollar</td></tr></tbody></table>


# PIM


# Attributes & Sets

The following four items will be discussed within the scope of product attributes.

1. Attribute
2. AttributeSet
3. AttributeConfig
4. AttributeValue

During the initial installation of Omnitron, product attributes, namely Attribute values, are created before the products themselves. AttributeSet values are created to keep these attribute values together. AttributeConfigs are then added to link Attributes and AttributeSets. Attributes and AttributeSets are linked completely through AttributeConfig, as there is no direct relation between them. Finally, an AttributeValue is added for each Attribute.

#### 1. Attribute

Indicates product attributes. Product properties, such as size, color, etc. are called Attributes. Attributes `AttributeInputTypes {omnicore.products.enums.AttributeInputTypes}` can have the following types: `text`, `boolean`, `dropdown` etc. Attribute values of products not productized are controlled with the `pre_attribute: bool` value, while the attribute values of a product marked as `pre_product will be pre_attibute=True`. Attribute objects are multilingual and can be localized.

#### 2. AttributeSet

Multiple Attributes form an `AttributeSet`. For example, the size and color of a product created for clothing will be the AttributeSet collectively belonging to the clothing products. AttributeSet may be of two different types: simple and grouped, as specified in `AttributeSetType {omnicore.products.enums.AttributeSetTypes}`.

#### 3. AttributeConfig

AttributeConfig is a bridge between Attribute and AttributeSet, and singular between the two properties. It means that there can only be one AttributeConfig between Attribute and AttributeSet.

#### 4. AttributeValue

Values of the product’s attributes. If a garment size is Attribute, sizes such as X, M, L and XL are AttributeValue. AttributeValue objects are multilingual and can be localized.

## `GET` Attributes

Path: `/api/v1/attributes/`

Brings the attribute values from the Attribute table. Gets the filter parameters with `{omnitron.products.resources.filters.AttributeFilter}` in AttributeFilter as query parameters. Supports pagination with ViewSet’s inheritance from `ListModelMixin` with query parameters of `page=X` and `limit=Y`.

**AttributeFilter**

Used in listing operations with GET used in AttributeViewSet. It can get the following parameters as a filter.

* data\_type: Contains Attribute type, takes AttributeInputTypes enum values. It allows multiple selections. E.g: /?data\_type=X\&data\_type=Y
* key: The code for the Attribute, requires an exact match.
* name:The namespace for the Attribute. It only needs to contain this value and works as case-sensitive.
* is\_required: Takes True/False value.
* is\_searchable: Takes True/False value.
* is\_variant: Takes True/False value.
* is\_variant\_listable: Takes True/False value.
* is\_visible: Takes True/False value.

## Attribute API Methods

### `GET` Attributes by Attribute Data Type

Path: `api/v1/attributes/?data_type=text/`

```json
{
  "count": 52,
  "next": "https://{customer_omnitron_url}/api/v1/attributes/?data_type=text&limit=20&page=2",
  "previous": null,
  "results": [
    {
      "pk": 995,
      "key": "max_installment",
      "data_type": "text",
      "default_value": null,
      "is_required": false,
      "is_visible": true,
      "is_searchable": false,
      "is_filterable": false,
      "is_variant": false,
      "is_variant_listable": false,
      "name": "max_installment",
      "is_form_required": false,
      "is_form_field_required": false,
      "erp_code": "max_installment",
      "pre_attribute": false,
      "description": "max_installment",
      "is_localizable": false,
      "entity_type": 1
      "modified_date": "2022-11-24T08:53:33.341501Z",
      "created_date": "2021-02-23T08:44:48.034000Z",

    }
  ]
}
```

### `POST` Create Attribute

Path: `api/v1/attributes/`

Adds a new record to the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

```json
{
    "key": "test",
    "data_type": "dropdown",
    "is_required": false,
    "is_visible": true,
    "is_searchable": false,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "Test Dropdown",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "erp_test",
    "pre_attribute": false,
    "is_localizable": false
}
```

**Response**

```json
{
    "pk": 1325,
    "key": "test",
    "data_type": "dropdown",
    "default_value": null,
    "is_required": false,
    "is_visible": true,
    "is_searchable": false,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "Test Dropdown",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "erp_test",
    "pre_attribute": false,
    "description": null,
    "is_localizable": false,
    "modified_date": "2023-01-04T19:21:28.149803Z",
    "created_date": "2023-01-04T19:21:28.149784Z",
    "entity_type": 1
}
```

**Errors**

```json
{
    "key": [
        "attribute with this key already exists."
    ]
}
-- OR
{
    "non_field_errors": "(erp_code:erp_gender) already exists",
    "error_code": "attribute_200_1"
}
```

### `DELETE` Attribute

Path: `/api/v1/attributes/{pk}/`

Deletes the object of the relevant primary key from the Attribute table. If it cannot find the object, it returns HTTP404.

**Response**

HTTP204

### `GET` Attribute

Path: `/api/v1/attributes/{pk}/`

Gets the object of the relevant primary key from the Attribute table. If it cannot find the object, it returns HTTP404.

**Response**

```json
{
    "pk": 995,
    "key": "max_installment",
    "data_type": "text",
    "default_value": null,
    "is_required": false,
    "is_visible": true,
    "is_searchable": false,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "max_installment",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "max_installment",
    "pre_attribute": false,
    "description": "max_installment",
    "is_localizable": false
}
```

### `PATCH` Update Attribute

Path: `/api/v1/attributes/{pk}/`

Partially updates the object of the relevant primary key from the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.

**Body**

```json
{
    "name": "Test Dropdown 1"
}
```

**Response**

```json
{
    "pk": 63,
    "key": "test",
    "data_type": "dropdown",
    "default_value": null,
    "is_required": false,
    "is_visible": true,
    "is_searchable": false,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "Test Dropdown 1",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "test",
    "pre_attribute": false,
    "description": null,
    "modified_date": "2023-01-04T19:24:56.538441Z",
    "created_date": "2023-01-04T19:21:28.149784Z",
    "entity_type": 1,
    "is_localizable": false
}
```

**Errors**

```json
{
    "key": [
        "You can only use lowercase and uppercase letters in English alphabet, digits and underscores."
    ]
}
-- OR
{
    "data_type": [
        "No matching type."
    ]
}
-- OR
{
    "non_field_errors": "Data Type can not be updated.",
    "error_code": "attribute_200_5"
}
-- OR
{
    "non_field_errors": [
        "is_localizable field cannot be True when Attribute data_type is not one of text or text_area."
    ]
}
```

### `PUT` Update Attribute

Path: `/api/v1/attributes/{pk}/`

Updates the object of the relevant primary key from the Attribute table. It is validated with AttributeSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.

### `GET` Attributes Details

Path: `/api/v1/attributes/detailed/`

Exhibits the same behavior as Attribute listing, but the return parameters are more detailed. The data\_type and visible\_values fields are retrieved in detail.

**Response**

```json
{
  "count": 52,
  "next": "https://{customer_omnitron_url}/api/v1/attributes/detailed/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 995,
      "key": "max_installment",
      "data_type": {
        "value": "text",
        "label": "Text"
      },
      "default_value": null,
      "is_required": false,
      "is_visible": true,
      "is_searchable": false,
      "is_filterable": false,
      "is_variant": false,
      "is_variant_listable": false,
      "name": "max_installment",
      "is_form_required": false,
      "is_form_field_required": false,
      "erp_code": "max_installment",
      "pre_attribute": false,
      "description": "max_installment",            
      "modified_date": "2017-01-21T14:54:14.364000Z",
      "created_date": "2016-12-14T15:01:20.124000Z",
      "entity_type": 1,
      "visible_values": []
    }
  ]
}
```

### `GET` Attribute Detail

Path: `/api/v1/attributes/{pk}/detailed/`

Exhibits the same behavior as getting Attributes, but the return parameters are more detailed. The data\_type and visible\_values fields are retrieved in detail.

**Response**

```json
{
  "pk": 269,
  "key": "forbidden",
  "data_type": {
    "value": "bool",
    "label": "Boolean"
  },
  "default_value": null,
  "is_required": false,
  "is_visible": false,
  "is_searchable": true,
  "is_filterable": true,
  "is_variant": false,
  "is_variant_listable": false,
  "name": "forbidden",
  "is_form_required": false,
  "is_form_field_required": false,
  "erp_code": "forbidden",
  "pre_attribute": false,
  "description": null,
  "modified_date": "2017-01-21T14:54:14.364000Z",
  "created_date": "2016-12-14T15:01:20.124000Z",
  "entity_type": 1,
  "visible_values": [
    {
      "pk": 3852,
      "attribute": 269,
      "value": "no",
      "order": null,
      "label": null,
      "erp_code": "false"
    },
    {
      "pk": 3851,
      "attribute": 269,
      "value": "yes",
      "order": null,
      "label": null,
      "erp_code": "true"
    }
  ]
}
```

### `GET` Attribute Translations

Path: `/api/v1/attributes/{pk}/translations/`

Brings the recorded localization values for the Attribute. Only the "name" parameter can be localized for the Attribute.

**Response**

```json
{
    "translations": {
        "fr-fr": {
            "name": "Taille"
        },
        "ar": {
            "name": "بحجم"
        },
        "tr-tr": {
            "name": "Beden"
        }
    }
}
```

## Attribute Set API Methods

### `GET` Attribute Sets

Path: `/api/v1/attribute_set/`

Brings the attribute values from the AttributeSet table. Gets the filter parameters in `AttributeSetFilter {omnitron.products.resources.filters.AttributeSetFilter}` as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.

**AttributeSetFilter**

Used in listing operations with GET used in AttributeSetViewSet. It can get the following parameters as a filter.

* attribute\_set\_type: Contains AttributeSet type, takes AttributeSetTypes enum values.
* name: The namespace for the AttributeSet. It only needs to contain this value and works as case-sensitive.

### `GET` Attribute Sets by Attribute Set Type

Filters can be used with GET requests as follows.

Path: `api/v1/attribute_set/?attribute_set_type=simple/`

**Response**

```json
{
  "count": 51,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_set/?attribute_set_type=simple&page=2",
  "previous": null,
  "results": [
    {
      "pk": 842,
      "name": "testacc1",
      "attribute_set_type": "simple",
      "attributeconfig_set": [
        {
          "pk": 3148,
          "attribute": 303,
          "attribute_set": 842,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_localizable"
          ],
          "order": 0,
          "is_form_required": false,
          "is_form_field_required": false
        }
      ],
    "description": null,
    "modified_date": "2021-11-10T17:42:33.171630Z",
    "created_date": "2017-01-20T19:02:43.782000Z"
    }
  ]
}
```

### `POST` Create Attribute Set

Path: `/api/v1/attribute_set/`

Adds a new record to the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

```json
{
    "name": "TestAttributeSet",
    "attribute_set_type": "simple",
    "description": "Test AttributeSet"
}
```

**Response**

```json
{
    "pk": 1040,
    "name": "TestAttributeSet",
    "attribute_set_type": "simple",
    "attributeconfig_set": [],
    "description": "Test AttributeSet",
    "modified_date": "2023-01-05T06:00:48.144781Z",
    "created_date": "2023-01-05T06:00:48.144761Z"
}
```

**Errors**

```json
{
    "name": [
        "attribute set with this name already exists."
    ]
}
```

### `DELETE` Attribute Set

Path: `/api/v1/attribute_set/{pk}/`

Deletes the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.

Response: HTTP204

### `GET` Attribute Set

Path: `/api/v1/attribute_set/{pk}/`

Gets the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.

**Response**

```json
{
    "pk": 1040,
    "name": "TestAttributeSet",
    "attribute_set_type": "simple",
    "attributeconfig_set": [],
    "description": "Test AttributeSet"
}
```

### `PATCH` Update Attribute Set

Path: `/api/v1/attribute_set/{pk}/`

Partially updates the object of the relevant primary key from the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.

**Body**

```json
{
    "name": "TestAttributeSet1"
}
```

**Response**

```json
{
    "pk": 72,
    "name": "TestAttributeSet1",
    "attribute_set_type": "simple",
    "attributeconfig_set": [],
    "description": "Test AttributeSet",
    "modified_date": "2023-01-05T06:02:54.953317Z",
    "created_date": "2023-01-05T06:00:48.144761Z"
}
```

**HTTP 200**

**Errors**

```json
{
    "name": [
        "attribute set with this name already exists."
    ]
}
```

### `PUT` Update Attribute Set

Path: `/api/v1/attribute_set/{pk}/`

Updates the object of the relevant primary key from the AttributeSet table. It is validated with AttributeSetSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.

**Body**

```json
{
    "name": "TestAttributeSet2",
    "attribute_set_type": "simple"
}
```

**Response**

```json
{
    "name": "TestAttributeSet2",
    "attribute_set_type": "simple",
    "attributeconfig_set": [],
    "description": "Test AttributeSet add new description",
    "modified_date": "2023-01-05T06:14:59.870777Z",
    "created_date": "2023-01-05T06:00:48.144761Z"
}
```

**HTTP 200**

**Errors**

```json
{
    "attribute_set_type": [
        "This field is required."
    ]
}
```

### `GET` Attribute Sets Details

Path: `/api/v1/attribute_set/detailed/`

Exhibits the same behavior as AttributeSet listing, but the return parameters are more detailed. It also gets individual Attribute values in "attributeconfig\_set."

**Response:**

```json
{
    "count": 73,
    "next": "http://localhost:8000/api/v1/attribute_set/detailed/?page=2",
    "previous": null,
    "results": [
         {
            "pk": 72,
            "name": "TestAttributeSet2",
            "attribute_set_type": {
                "value": "simple",
                "label": "Simple"
            },
            "attributeconfig_set": [],
            "description": "Test AttributeSet add new description",
            "modified_date": "2023-01-05T06:16:28.507891Z",
            "created_date": "2023-01-05T06:00:48.144761Z"
        }
     ...
     ]
}
```

### `GET` Attribute Set Detail by Attribute Set Type

Path: `api/v1/attribute_set/detailed/?attribute_set_type=simple/`

**Response**

```json
{
  "count": 61,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_set/detailed/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 842,
      "name": "testacc1",
      "attribute_set_type": {
        "value": "simple",
        "label": "Simple"
      },
      "attributeconfig_set": [
        {
          "pk": 3148,
          "attribute": {
            "pk": 303,
            "key": "123",
            "data_type": "dropdown",
            "default_value": null,
            "is_required": false,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": false,
            "is_variant_listable": false,
            "name": "12344",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "1234444",
            "pre_attribute": false,
            "description": null
          },
          "attribute_set": 842,
          "is_required": false,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": false,
          "is_variant_listable": false,
          "default_fields": [
            "is_localizable"
          ],
          "order": 0,
          "is_form_required": false,
          "is_form_field_required": false
        },
        {
          "pk": 2923,
          "attribute": {
            "pk": 1128,
            "key": "acctestattribute2",
            "data_type": "dropdown",
            "default_value": 4911,
            "is_required": true,
            "is_visible": true,
            "is_searchable": true,
            "is_filterable": true,
            "is_variant": true,
            "is_variant_listable": true,
            "name": "acctestattribute2",
            "is_form_required": false,
            "is_form_field_required": false,
            "erp_code": "acctestattribute2",
            "pre_attribute": false,
            "description": "acctestattribute2"
          },
          "attribute_set": 842,
          "is_required": true,
          "is_visible": true,
          "is_searchable": true,
          "is_filterable": true,
          "is_variant": true,
          "is_variant_listable": true,
          "default_fields": [
            "is_localizable"
          ],
          "order": 2,
          "is_form_required": false,
          "is_form_field_required": false
        }
      ],
      "description": null,
      "modified_date": "2023-01-05T06:16:28.507891Z",
      "created_date": "2023-01-05T06:00:48.144761Z"

    }
  ]
}

```

### `GET` Attribute Set Detail

Path: `/api/v1/attribute_set/{pk}/detailed/`

Exhibits the same behavior as getting AttributeSets, but the return parameters are more detailed. It also gets individual Attribute values in "attributeconfig\_set."

**Response**

```json
{
  "pk": 1040,
  "name": "TestAttributeSet",
  "attribute_set_type": {
    "value": "simple",
    "label": "Simple"
  },
  "attributeconfig_set": [],
  "description": "Test AttributeSet"
}

```

## Attribute Config API Methods

### `GET` Attribute Configs

Path: `/api/v1/attribute_config/`

Gets the values in the AttributeConfig table. Gets the filter parameters with `{omnitron.products.resources.filters.AttributeConfigFilter}` in AttributeConfigFilter as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.

**AttributeConfigFilter**

Used in listing operations with GET used in AttributeConfigViewSet. It can get the following parameters as a filter.

* attribute: pk value of the relevant Attribute object.
* attribute\_set: pk value of the relevant AttributeSet object.

### `GET` Attribute Config by Attribute

Path: `api/v1/attribute_config/?attribute={pk}`

**Response**

```json
{
  "count": 14,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_config/?attribute=303&page=2",
  "previous": null,
  "results": [
    {
      "pk": 1300,
      "attribute": 303,
      "attribute_set": 3,
      "is_required": false,
      "is_visible": true,
      "is_searchable": true,
      "is_filterable": true,
      "is_variant": false,
      "is_variant_listable": false,
      "default_fields": [
        "is_localizable"
      ],
      "order": 0,
      "is_form_required": false,
      "is_form_field_required": false,
      "modified_date": "2018-08-15T12:12:19.394963Z",
      "created_date": "2017-01-21T16:47:12.115000Z",
      "is_localizable": false

    }
  ]
}

```

### `POST` Create Attribute Config

Path: `/api/v1/attribute_config/`

Adds a new record to the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

**Body**

```json
{
    "attribute": 995,
    "attribute_set": 842,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": false,
    "is_variant_listable": false,
    "is_form_required": false,
    "is_form_field_required": false
}
```

**Response**

```json
{
    "pk": 2447,
    "attribute": 1,
    "attribute_set": 72,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": false,
    "is_variant_listable": false,
    "default_fields": [
        "is_localizable"
    ],
    "order": 0,
    "is_form_required": false,
    "is_form_field_required": false,
    "modified_date": "2023-01-05T06:26:12.416073Z",
    "created_date": "2023-01-05T06:26:12.416053Z",
    "is_localizable": false
}

```

**Errors**

```json
{
    "attribute": [
        "Invalid pk \"995\" - object does not exist."
    ],
    "attribute_set": [
        "Invalid pk \"842\" - object does not exist."
    ]
}
-- OR
{
  "code": "attribute_config_203_5",
  "en": "Multiple type attribute cannot assign to an attribute set"
}
-- OR
{
    "non_field_errors": [
        "The fields attribute, attribute_set must make a unique set."
    ]
}
-- OR
{
    "code": "attribute_config_203_3",
    "en": "Attribute config custom attribute set validation error. Custom attribute set doesn't accept variant attribute"
}
-- OR
{
    "code": "attribute_config_203_4",
    "en": "This attribute cannot exist in custom attribute set and attribute set"
}
```

### `DELETE` Attribute Config

Path: `/api/v1/attribute_config/{pk}/`

Deletes the object of the relevant primary key from the AttributeConfig table. If it cannot find the object, it returns HTTP404.

Response: HTTP204

### `GET` Attribute Config

Path: `/api/v1/attribute_config/{pk}/`

Gets the object of the relevant primary key from the AttributeSet table. If it cannot find the object, it returns HTTP404.

**Response**

```json
{
    "pk": 3247,
    "attribute": 995,
    "attribute_set": 842,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": false,
    "is_variant_listable": false,
    "default_fields": ["is_localizable"],
    "order": 5,
    "is_form_required": false,
    "is_form_field_required": false
}

```

### `PATCH` Update Attribute Config

Path: `/api/v1/attribute_config/{pk}/`

Partially updates the object of the relevant primary key from the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.

**Body**

```json
{
    "is_visible": true
}
```

**Response**

```json
{
    "pk": 2447,
    "attribute": 1,
    "attribute_set": 72,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": false,
    "is_variant_listable": false,
    "default_fields": [
        "is_localizable"
    ],
    "order": 0,
    "is_form_required": false,
    "is_form_field_required": false,
    "modified_date": "2023-01-05T06:34:27.218889Z",
    "created_date": "2023-01-05T06:26:12.416053Z",
    "is_localizable": false
}
```

**Errors**

```json
{
    "attribute_set": [
        "Invalid pk \"700\" - object does not exist."
    ]
}
-- OR
{
    "attribute": [
        "Invalid pk \"10000\" - object does not exist."
    ]
}
-- OR
{
    "non_field_errors": [
        "The fields attribute, attribute_set must make a unique set."
    ]
}
-- OR
{
    "non_field_errors": "Attribute config custom attribute set validation error. Custom attribute set doesn't accept variant attribute",
    "error_code": "attribute_config_203_3"
}
```

### `PUT` Update Attribute Config

Path `/api/v1/attribute_config/{pk}/`

Updates the object of the relevant primary key from the AttributeConfig table. It is validated with AttributeConfigSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.

**Body**

```json
{
    "attribute": 1,
    "attribute_set": 72,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": true,
    "is_variant_listable": false,
    "is_form_required": false,
    "is_form_field_required": false
}
```

**Response**

```json
{
    "pk": 2447,
    "attribute": 1,
    "attribute_set": 72,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": true,
    "is_variant_listable": false,
    "default_fields": [
        "is_localizable"
    ],
    "order": 0,
    "is_form_required": false,
    "is_form_field_required": false,
    "modified_date": "2023-01-05T07:12:55.475601Z",
    "created_date": "2023-01-05T06:26:12.416053Z",
    "is_localizable": false
}
```

**Errors**

```json
{
    "is_visible": [
        "This field is required."
    ],
    "is_variant_listable": [
        "This field is required."
    ],
    "attribute": [
        "This field is required."
    ],
    "is_form_required": [
        "This field is required."
    ],
    "is_filterable": [
        "This field is required."
    ],
    "is_searchable": [
        "This field is required."
    ],
    "is_form_field_required": [
        "This field is required."
    ],
    "attribute_set": [
        "This field is required."
    ],
    "is_required": [
        "This field is required."
    ]
}
```

### `GET` Attribute Configs Details

Path: `/api/v1/attribute_config/detailed/`

Exhibits the same behavior as AttributeSet listing, but the return parameters are more detailed. Gets the associated attribute value in detail.

**Response**

```json
{
  "count": 14,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_config/detailed/?attribute=303&page=2",
  "previous": null,
  "results": [
    {
      "pk": 1300,
      "attribute": {
        "pk": 303,
        "key": "123",
        "data_type": "dropdown",
        "default_value": null,
        "is_required": false,
        "is_visible": true,
        "is_searchable": true,
        "is_filterable": true,
        "is_variant": false,
        "is_variant_listable": false,
        "name": "12344",
        "is_form_required": false,
        "is_form_field_required": false,
        "erp_code": "1234444",
        "pre_attribute": false,
        "description": null
      },
      "attribute_set": 3,
      "is_required": false,
      "is_visible": true,
      "is_searchable": true,
      "is_filterable": true,
      "is_variant": false,
      "is_variant_listable": false,
      "default_fields": [
        "is_localizable"
      ],
      "order": 0,
      "is_form_required": false,
      "is_form_field_required": false
    }
  ],
  "modified_date": "2022-12-29T11:26:06.800700Z",
  "created_date": "2022-12-29T11:26:06.800693Z",
  "is_localizable": false
}
```

### `GET` Attribute Config Detail

Path: `/api/v1/attribute_config/{pk}/detailed/`

Exhibits the same behavior as getting AttributeConfigs, but the return parameters are more detailed. Gets the associated attribute value in detail.

**Response**

```json
{
  "pk": 1300,
  "attribute": {
    "pk": 303,
    "key": "123",
    "data_type": "dropdown",
    "default_value": null,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": true,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "12344",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "1234444",
    "pre_attribute": false,
    "description": null
  },
  "attribute_set": 3,
  "is_required": false,
  "is_visible": true,
  "is_searchable": true,
  "is_filterable": true,
  "is_variant": false,
  "is_variant_listable": false,
  "default_fields": [
    "is_localizable"
  ],
  "order": 0,
  "is_form_required": false,
  "is_form_field_required": false,
  "modified_date": "2023-01-05T07:12:55.475601Z",
  "created_date": "2023-01-05T06:26:12.416053Z",
  "is_localizable": false
}
```

## Attribute Value API Methods

### `GET` Attribute Values

Path: `/api/v1/attribute_value/`

Gets the values in the AttributeValue table. Gets the filter parameters in `AttributeValueFilter {omnitron.products.resources.filters.AttributeValueFilter}` as query parameters. Supports pagination with ViewSet’s inheritance from ListModelMixin with query parameters of page=X and limit=Y.

**AttributeValueFilter**

Used in listing operations with GET used in AttributeValueViewSet. It can get the following parameters as a filter.

* label: The title field for the AttributeValue. It only needs to contain this value and works as case-sensitive.
* erp\_code: The erp code field for the AttributeValue. It only needs to contain this value.
* value: The value field for the AttributeValue. It only needs to contain this value.
* value\_\_exact: The value field for the AttributeValue. It requires a complete match.
* attribute: pk value of the relevant Attribute object.

**Response**

```json
{
  "count": 20,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_value/?attribute=667&page=2",
  "previous": null,
  "results": [
    {
      "pk": 4019,
      "attribute": 667,
      "value": "Beyaz",
      "order": null,
      "label": "White",
      "erp_code": "White",
      "modified_date": "2018-08-15T12:12:22.588620Z",
      "created_date": "2017-01-21T18:46:22.218000Z"

    },
    {
      "pk": 4020,
      "attribute": 667,
      "value": "Bordo",
      "order": null,
      "label": "Claret Red",
      "erp_code": "Claret Red",
      "modified_date": "2018-08-15T12:12:22.588620Z",
      "created_date": "2017-01-21T18:46:22.218000Z"
    }
  ]
}
```

### `POST` Create Attribute Value

Path: `/api/v1/attribute_value/`

Adds a new record to the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

```json
{
    "attribute": 995,
    "label": "Test",
    "value": "Test Value",
    "erp_code": "erp_test"
}
```

**Response**

```json
{
    "pk": 5072,
    "attribute": 995,
    "value": "Test Value",
    "order": null,
    "label": "Test",
    "erp_code": "erp_test",
    "modified_date": "2023-01-05T07:26:16.974706Z",
    "created_date": "2023-01-05T07:26:16.974689Z"
}
```

**Errors**

```json
{
    "attribute": [
        "Invalid pk \"995\" - object does not exist."
    ]
}
-- OR
{
    "non_field_errors": [
        "The fields attribute, value must make a unique set."
    ]
}

-- OR
{
    "non_field_errors": "... already exists",
    "error_code": "attribute_value_201_1"
}
```

### `GET` Attribute Value

Path: `/api/v1/attribute_value/{pk}/`

Gets the object of the relevant primary key from the AttributeValue table. If it cannot find the object, it returns HTTP404.

**Response**

```json
{
    "pk": 5072,
    "attribute": 995,
    "value": "Test Value",
    "order": null,
    "label": "Test",
    "erp_code": "erp_test",
    "modified_date": "2018-08-15T12:12:22.588620Z",
    "created_date": "2017-01-21T18:46:22.218000Z"
}
```

### `PATCH` Update Attribute Value

Path: `/api/v1/attribute_value/{pk}/`

Partially updates the object of the relevant primary key from the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With a partial update behavior, it only updates the sent parameters.

**Body**

```json
{
    "label": "Test1"
}
```

**Response**

```json
{
    "pk": 976,
    "attribute": 1,
    "value": "Test Value",
    "order": null,
    "label": "Test1",
    "erp_code": "erp_test",
    "modified_date": "2023-01-05T07:33:36.127252Z",
    "created_date": "2023-01-05T07:26:16.974689Z"
}
```

**Errors**

```json
{
    "non_field_errors": "... already exists",
    "error_code": "attribute_value_201_1"
}
-- OR
{
    "non_field_errors": ""AttributeValue can not be updated."",
    "error_code": "attribute_value_201_2"
}
```

### `PUT` Update Attribute Value

Path: `/api/v1/attribute_value/{pk}/`

Updates the object of the relevant primary key from the AttributeValue table. It is validated with AttributeValueSerializer. If the data is not suitable, it returns HTTP400. If it cannot find the object, it returns HTTP404. With an update behavior, it updates the entire object.

**Body**

```json
{
    "attribute": 1,
    "label": "Test2",
    "value": "Test Value",
    "erp_code": "erp_test"
}
```

**Response**

```json
{
    "pk": 976,
    "attribute": 1,
    "value": "Test Value",
    "order": null,
    "label": "Test2",
    "erp_code": "erp_test",
    "modified_date": "2023-01-05T07:41:09.023560Z",
    "created_date": "2023-01-05T07:26:16.974689Z"
}
```

**Errors**

```json
{
    "attribute": [
        "This field is required."
    ],
    "value": [
        "This field is required."
    ],
    "erp_code": [
        "This field is required."
    ]
}
```

### `DELETE` Attribute Value

Path: `/api/v1/attribute_value/{pk}/`

Deletes the object of the relevant primary key from the AttributeConfig table. If it cannot find the object, it returns HTTP404.

Response: HTTP204

### `GET` Attribute Values Details

Path: `/api/v1/attribute_value/detailed/`

Exhibits the same behavior as AttributeValue listing, but the return parameters are more detailed. Gets the associated attribute value in detail.

**Response**

```json
{
  "count": 20,
  "next": "https://{customer_omnitron_url}/api/v1/attribute_value/detailed/?attribute=667&page=2",
  "previous": null,
  "results": [
    {
      "pk": 4019,
      "value": "White",
      "order": null,
      "label": "White",
      "attribute": {
        "pk": 667,
        "key": "mp_filterable_color",
        "data_type": "dropdown",
        "default_value": 4035,
        "is_required": false,
        "is_visible": true,
        "is_searchable": true,
        "is_filterable": true,
        "is_variant": false,
        "is_variant_listable": false,
        "name": "MP Filtrable Color",
        "is_form_required": false,
        "is_form_field_required": false,
        "erp_code": "mp_filterable_color",
        "pre_attribute": false,
        "description": null,
        "modified_date": "2023-01-05T07:41:09.023560Z",
        "created_date": "2023-01-05T07:26:16.974689Z",
        "entity_type": 1
      },
    },
    {
      "pk": 4020,
      "value": "Claret Red",
      "order": null,
      "label": "Claret Red",
      "attribute": {
        "pk": 667,
        "key": "mp_filterable_color",
                "data_type": "dropdown",
        "default_value": 4035,
        "is_required": false,
        "is_visible": true,
        "is_searchable": true,
        "is_filterable": true,
        "is_variant": false,
        "is_variant_listable": false,
        "name": "MP Filtrable Color",
        "is_form_required": false,
        "is_form_field_required": false,
        "erp_code": "mp_filterable_color",
        "pre_attribute": false,
        "description": null,
        "modified_date": "2023-01-05T07:41:09.023560Z",
        "created_date": "2023-01-05T07:26:16.974689Z",
        "entity_type": 1
      }
    }
  ]
}
```

### `GET` Attribute Value Detail

Path: `/api/v1/attribute_value/{pk}/detailed/`

Exhibits the same behavior as getting AttributeValue, but the return parameters are more detailed. Gets the associated attribute value in detail.

**Response**

```json
{
    "pk": 4019,
    "value": "White",
    "order": null,
    "label": "White",
    "attribute": {
        "pk": 667,
        "key": "mp_filterable_color",
        "data_type": "dropdown",
        "default_value": 4035,
        "is_required": false,
        "is_visible": true,
        "is_searchable": true,
        "is_filterable": true,
        "is_variant": false,
        "is_variant_listable": false,
        "name": "MP Filtrable Color",
        "is_form_required": false,
        "is_form_field_required": false,
        "erp_code": "mp_filterable_color",
        "pre_attribute": false,
        "description": null,
        "modified_date": "2017-01-21T14:54:14.359000Z",
        "created_date": "2016-12-14T14:56:02.160000Z",
        "entity_type": 1
    }
}
```

### `GET` Attribute Value Translations

Path: `/api/v1/attribute_value/{pk}/translations/`

Brings the recorded localization values for the AttributeValue. Only the "label" parameter can be localized for the AttributeValue.

**Response**

```json
{
  "translations": {
    "en-us": {
      "label": "White"
    },
    "tr-tr": {
      "label": "Beyaz"
    }
  }
}
```


# Mapping

Omnitron provides an easy-to-use mapping interface enabling you to associate the products integrated from ERP or other external resources and approved on **Integrations > Pending Products** page with Omnitron.

{% hint style="warning" %}
Mapping process is needed only if you prefer to use the pending product stage before the productization process. You might skip this stage if you prefer to handle the mapping process on the integration layer and directly send your products to the Product Pool.
{% endhint %}

## <mark style="color:red;">Mapping Model Structure</mark>

Mapping is a matching process between values coming from ERP and external sources.

The mapping model consists of the following strategies:

`AttributeValueMappingStrategy` : This strategy leads to map attribute values

The strategy used to match attribute values. Pulls custom `is_localizable` and language parameters from kwargs. According to these parameters, it is decided whether the attribute will be pulled according to the language. Then, the `default_value` is drawn from the `output_kwargs` in the mapping model and the value is retrieved according to the `mapping_key` in the mapping model. If value does not exist and the default\_attribute is present, it pulls the attribute directly from the product object and maps it to value. After that, it returns (value, True) if pulled from the default\_attribute. If pulled directly from mapping (value, False).

`AttributeSetMappingStrategy` : This strategy leads to map \[Attribute Set],

There are no language operations as in AttributeValueMappingStrategy, but the rest of the value pulling process is the same. When returning, the value is returned directly.

Path: `omnitron.mappings.models.Mapping`

* *Mapping\_Type (EnumField)*: Indicates the mapping type. Its values are;
  * `attribute`='attribute'
  * `attribute_set`='attribute set'
  * `attribute_value`='attribute value'
* *input\_kwargs (JSONField)*: Represents the attributes' rules
* *output\_kwargs (JSONField)*: Represents default values
* *priority (integer)*: Indicates the mapping priority
* *mapping\_key*: The name of the attribute to be associated with

### MappingViewSet

MappingViewSet `{omnitron.mappings.resources.views.MappingViewSet}` is located at the address of `/api/v1/mappings/`.

Allows GET, POST, PUT, PATCH and DELETE methods inherited from ModelViewSet. perform\_create(), perform\_update() and perform\_destroy() functions are overridden; perform create/update operations on the relevant MappingService.

And one property named strategy is defined. This property returns the two strategies mentioned above in class format upon fetching from mapping\_type.

<table data-header-hidden><thead><tr><th width="114.078125"></th><th width="75.1171875"></th><th width="87.625"></th><th width="81.10546875"></th><th width="94.671875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Data Type</strong></td><td><strong>Default</strong></td><td><strong>In</strong></td><td><strong>Required</strong></td><td><strong>Description</strong></td></tr><tr><td>api_token</td><td>string</td><td></td><td>header</td><td>YES</td><td><a href="/omnitron/getting-started">The API key of the customer’s account</a></td></tr><tr><td>product_sku</td><td>string</td><td></td><td>body</td><td>YES</td><td>Product SKU</td></tr><tr><td>stock_list</td><td>id</td><td></td><td>body</td><td>YES</td><td>Stock list which includes the product</td></tr><tr><td>stock</td><td>integer</td><td>0</td><td>body</td><td>NO</td><td>Amount of stock</td></tr><tr><td>unit_type</td><td>enum(string)</td><td>qty</td><td>body</td><td>NO</td><td>Stocked quantity type<br>qty: Quantity<br>kg: Kilogram</td></tr></tbody></table>

## `GET` Mapping

Get request to get list of mapping objects.

Path: `/api/v1/mappings/`

```json
{
    "count": 499,
    "next": "{customer_omnitron_url}/api/v1/mappings/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 2515,
            "created_date": "2017-01-22T07:43:38.446000Z",
            "modified_date": "2017-01-22T07:43:38.446000Z",
            "mapping_type": "attribute_value",
            "value_dict": {
                "attributes__erp_color": "BEYAZ"
            },
            "default_value": {
                "filtre_renk1": "Beyaz"
            },
            "default_attribute": null,
            "priority": 0,
            "mapping_key": "filtre_renk1",
            "create_all_kind": false
        },
        ...
    ]
}
```

## `POST` Create Mapping

Adds a new record to the mapping table.Validated with MappingSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the recording process.

Path: `/api/v1/mappings/`

**Body**

```json
{
    "mapping_type": "attribute_value",
    "value_dict": {
        "attributes__erp_color": "TEST"
    },
    "default_value": {
        "filtre_renk1": "Test"
    },
    "default_attribute": null,
    "priority": 0,
    "mapping_key": "filtre_renk1",
    "create_all_kind": false
}
```

**Response**

```json
{
    "pk": 3014,
    "created_date": "2023-01-05T19:06:07.007354Z",
    "modified_date": "2023-01-05T19:06:07.007381Z",
    "mapping_type": "attribute_value",
    "value_dict": {
        "attributes__erp_color": "TEST"
    },
    "default_value": {
        "filtre_renk1": "Test"
    },
    "default_attribute": null,
    "priority": 0,
    "mapping_key": "filtre_renk1",
    "create_all_kind": false
}

```

**Errors**

```json
{
  {
    "non_field_errors": "... required field",
    "error_code": "mapping_101"
}
-- OR
{
    "mapping_type": [
        "This field is required."
    ]
}
-- OR
{
  {
    "non_field_errors": "{0} field type is not {1}",
    "error_code": "mapping_101"
}
-- OR
{
    "value_dict": [
        "Expected a dictionary of items but got type \"list\"."
    ]
}
```

## `PATCH` Partial Update

Path: `/api/v1/mappings/{pk}/`

Partially updates the object of the relevant primary key from the attribute table. Validated with AttributeSerializer. Returns HTTP400 if data is not available. If it cannot find the object, it returns HTTP404. With partial update behavior, it only updates the sent parameters.

**Body**

```json
{
    "create_all_kind": true
}
```

**Response**

```json
{{
    "pk": 3016,
    "created_date": "2023-01-05T19:15:39.212420Z",
    "modified_date": "2023-01-05T19:20:57.624044Z",
    "mapping_type": "attribute_value",
    "default_attribute": null,
    "priority": 0,
    "mapping_key": "filtre_renk1",
    "value_dict": {
        "attributes__erp_color": "TEST"
    },
    "default_value": {
        "filtre_renk1": "Test Renk"
    },
    "create_all_kind": true
}
```

## `PUT` Partial Update

Path: `/api/v1/mappings/{pk}/`

Updates the object of the corresponding primary key from the mapping table. Validated with MappingSerializer. Returns HTTP400 if data is not available. If it cannot find the object, it returns HTTP404. Updates the entire object with the update behavior.

**Body**

```json
{
    "mapping_type": "attribute_value",
    "value_dict": {
        "attributes__erp_color": "TEST"
    },
    "default_value": {
        "filtre_renk1": "Test Renk"
    },
    "default_attribute": null,
    "priority": 0,
    "mapping_key": "filtre_renk1",
    "create_all_kind": false
}
```

**Response**

```json
{
    "pk": 3016,
    "created_date": "2023-01-05T19:15:39.212420Z",
    "modified_date": "2023-01-05T19:16:14.737971Z",
    "mapping_type": "attribute_value",
    "value_dict": {
        "attributes__erp_color": "TEST"
    },
    "default_value": {
        "filtre_renk1": "Test Renk"
    },
    "default_attribute": null,
    "priority": 0,
    "mapping_key": "filtre_renk1",
    "create_all_kind": false
}
```

**Errors**

```json
{
    "mapping_type": [
        "This field is required."
    ],
    "mapping_key": [
        "This field is required."
    ]
}
```


# Localization

## Django Standard Translation

Translations are related to the language settings users need.

## Internationalization and Localization

Internationalization and Localization allow format and language adjustments in a Django project to meet user needs. Accordingly, Django supports text translation, date, time and number formatting and time zone usage. In this context, it is determined in which parts of the project applications (apps) the format and language conversions will be made, and it is ensured that the relevant applications are presented according to the language preferences made by the users. Internationalization means making the project suitable for language and format conversions. This process is carried out by the developer. Localization, on the other hand, is the writing of local formats with translations. This process is carried out by translators.

## Translating Product Model Fields into Different Languages

`omnitron.products.models.Product` model is inherited from `omnicore.products.models.BaseProduct` model, which is inherited from `omnicore.eav.models.Entity` abstract class model. In the entity model, there are `localized_attributes` and `localized_attributes_kwargs` fields related to localization. The `set_translatable_field` method defined in the model allows the selected fields to be selected for translation. In the product model, the "name" space is defined for localization. This way, product names can be translated into the languages allowed in the settings according to the user’s preferences.

## Model, Service and ViewSet

In the Meta class in the models in Omnitron, the translatable fields of the model are indicated as `translatable_fields`. The addition of the required translations as model fields is made for the areas specified in translatable\_fields over `TranslatableModelMixin` using the nece python package. In the models where Mixin is used, a field named translations is formed and translation information is included in the form of key:value.

The methods in the `omnicore.eav.models.Entity` model inherited by the product model allow translations of the fields specified in translatable\_fields. Attributes can be added with the set\_attribute method in the model. If the `is_localizable` property of the Attribute is True, the added property is added to `localized_attributes`.

## Entity Model Methods

The Entity Model inherited by the Product Model enables product attributes to be translatable. The defined methods from the Entity Model are listed below.

#### **`set_translatable_field`**

Received Parameters: key, value, language=None

Function: Allows adding attributes to the instance. If the key value given as input is defined in translatable\_fields, it is added as localized\_attribute; if not, it is added as `attributes_kwargs`.

#### **`set_language`**

Received Parameters: language\_code

Function: Allows adding the \_language\_code variable to the instance.

#### **`set_attribute_language`**

Received Parameters: language\_code

Function: Adds localized attribute values to the instance and updates the attribute values according to the selected language.

#### **`get_attribute_value`**

Received Parameters: key, language, default

Function: Allows calling of attribute information.

#### **`get_attribute_kwargs_value`**

Received Parameters: key, language, default

Function: Allows calling of attribute\_kwargs information.

#### **`clear_attributes`**

Received Parameters: language

Function: Allows the deletion of attributes, attribute\_kwargs, localized\_attributes and localized\_attributes\_kwargs information.

#### **`set_attribute`**

Received Parameters: key, value, language=None

Function: Allows recording the attributes, attributes\_kwargs, localized\_attributes and localized\_attributes\_kwargs information to the Product instance. Allows attribute and attribute\_kwargs with is\_localizable value to be saved as localized\_atributes and localized\_attribute\_kwargs.

#### **`get_attributes`**

Received Parameters: language=None

Function: Allows getting all Instance attributes and localized\_attributes values.

#### **`get_attributes_kwargs`**

Received Parameters: language=None

Function: Allows getting all Instance attributes\_kwargs and localized\_attribute\_kwargs values.

#### **`default_language`**

Received Parameters: -

Function: Returns the value LANGUAGE\_CODE, which is defined in settings and specifies the default language option.

#### **`get_localized_attributes` : function​**

Received Parameters: language=None

Function: Returns localized attribute values (localized\_attribute).

#### **`get_localized_attributes_kwargs`​**

Received Parameters: language=None \**Function*: Returns localized attribute\_kwargs values (localized\_attribute\_kwargs).

#### **`get_merged_attributes`​**

Received Parameters: language=None

Function: Allows all attribute and attribute\_kwargs of the instance to be returned together.

#### **`get_translatable_field_keys`​**

Received Parameters: -

Function: Returns the key information in the "translatable\_fields" value of the model.

## Models with Translatable Fields

The following models in Omnitron (and other models that inherit from these models) are models that can take the translatable\_fields value in the Meta class, which allows translation according to the selected language. Other information about the models is provided in the table.

| **App**  | **Model**          | **translatable\_field** | **Translation Inheritance From** | **Serializer**                       |
| -------- | ------------------ | ----------------------- | -------------------------------- | ------------------------------------ |
| products | Product            | name                    | Entity                           | ProductSerializer                    |
| products | Attribute          | name                    | TranslatableModelMixin           | AttributeSerializerWithIsLocalizable |
| products | AttributeValue     | label                   | TranslatableModelMixin           | AttributeValueSerializer             |
| address  | Country            | name                    | TranslatableModelMixin           | CountrySerializer                    |
| address  | City               | name                    | TranslatableModelMixin           | CitySerializer                       |
| address  | RetailStore        | name                    | TranslatableModelMixin           | PaymentOptionSerializer              |
| payments | Installment        | label                   | TranslatableModelMixin           | InstallmentSerializer                |
| orders   | CancellationReason | subject                 | TranslatableModelMixin           | CancellationReasonSerializer         |
| catalogs | CategoryNode       | name                    | Entity                           | CategoryNodeSerializer               |
| search   | SortOption         | label                   | TranslatableModelMixin           | SortOptionSerializer                 |

#### **TranslatableModelMixin​**

TranslatableModelMixin is inherited by many of the models in Omnitron defined as translatable\_fields. The list of these models can be found above.The translation values of the fields specified for model localization are created in JSONB format as a translation field object is returned. Returns None if there is no translation for the specified language.

`language_as_dict`​

Received Parameters: language\_code

Function: With language\_code, it returns the key-value (dictionary) in the translations field of the desired language.

**Example**

```
    >> country = Country.objects.first()
    >> print(country.name)
```

```
    Türkiye
```

```
       >> country.language_as_dict('en-us')
    {'name': 'Turkey'}
```

TranslationModel also inherits TranslationMixin from the nece package. This mixin class takes the TRANSLATIONS\_DEFAULT and TRANSLATIONS\_MAP values from the project settings. If these values are not specified in the project, the value en\_us is set as the default language option.

## HTTP Request Examples

Examples are based on the omnitron.address.Country model, which includes a translations field. The model inherits TranslatableModelMixin.

### `POST` Create Country

POST request creates a new instance of Country. If successful, the response status will be HTTP 201.

Path: `/api/v1/countries/`

```json
{
    "is_active": boolean,         # mandatory
    "name": string,               # mandatory
    "code": "de",                 # mandatory
    "translations": JSONField     # optional
}

```

**Response**

```json
{
    "pk": 12,
    "is_active": true,
    "name": "Germany",
    "code": "de",
    "translations": null,
    "modified_date": "2023-01-04T17:40:49.214191Z",
    "created_date": "2023-01-04T17:40:49.214163Z"
}

```

### `PATCH` Update Country

PATCH request updates an existing instance. If the body of the request includes the `translations` field regarding values for languages, then the instance's translatable fields can be translated into these languages.

Path: `/api/v1/countries/{pk}/`

```json
{
    "translations": {
        "tr": {"name": "Almanya"},
        "de": {"name": "Deutschland"},
        "it": {"name": "Germania"}
        }
}
```

**Response**

```json
  {
    "pk": 12,
    "is_active": true,
    "name": "Germany",
    "code": "de",
    "translations": {
        "de": {
            "name": "Deutschland"
        },
        "tr": {
            "name": "Almanya"
        },
        "it": {
            "name": "Germania"
        }
    },
    "modified_date": "2023-01-04T17:41:52.987683Z",
    "created_date": "2023-01-04T17:40:13.065454Z"
}
```

## Product Model

Since an attribute or attribute value of a product in the Product model inherits from the TranslatableModelMixin class, it comes with a translations field. In order to access translations of an attribute or attribute value in different languages, a request can be made by adding "translations" to the url. Examples are listed below.

Attribute adds new objects to the table. With the JSONField, which can be provided as the translation value in the Request Body, the translations of the name field in different languages are included in the translations field in the object. The AttributeSerializer class at omnitron.products.resources.serializers is used for data verification.

### `POST` Create Attribute

POST request creates a new Attribute instance. If successful, the response status will be HTTP 201.

Path: `/api/v1/attributes/`

```json
{
    "name": "Erp Gender",
    "data_type": "dropdown",
    "entity_type_id": 2,
    "erp_code": "erp_gender",
    "is_filterable": false,
    "is_form_field_required": false,
    "is_form_required": false,
    "is_localizable": false,
    "is_required": false,
    "is_searchable": true,
    "is_variant": false,
    "is_varian_listable": false,
    "is_visible": true,
    "key": "erp_gender",
    "pre_attribute": true,
    "translations": {"ar": {"name": "Erp الجنس"}, "en-us": {"name": "Erp Gender"}, "tr-tr": {"name": "ERP Cinsiyet"}}
}

```

**Response**

```json
 {
    "pk": 61,
    "key": "erp_gender",
    "data_type": "dropdown",
    "default_value": null,
    "is_required": false,
    "is_visible": true,
    "is_searchable": true,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "Erp Gender",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "erp_gender",
    "pre_attribute": true,
    "description": null,
    "is_localizable": false,
    "modified_date": "2023-01-04T18:13:24.489211Z",
    "created_date": "2023-01-04T18:13:24.489194Z",
    "entity_type": 1,
}

```

### `GET` Attribute Translations

GET request to the translation endpoint gives the available translatable fields and their translations.

Path: `/api/v1/attributes/{pk}/translations/`

The response is returned upon serializing the object specified with the primary key from the Attribute table together with the AttributeTranslationSerializer class defined at omnitron.products.resources.serializers.

**Response**

```json
 {
    "translations": {
        "fr-fr": {
            "name": "Couleur"
        },
        "ar": {
            "name": "اللون"
        },
        "tr-tr": {
            "name": "Renk"
        }
    }
}
```

**Failed Response**

If the attribute instance does not exist with the given pk, the response will be as follows:

```json
 {
    "detail": "Not found."
}
```

### `PATCH` Update Attribute Translations

Attribute updates the object specified with the primary key from the table. Updates the translations field according to the values in JSON. The AttributeSerializer class at omnitron.products.resources.serializers is used for data verification.

Path: `/api/v1/attributes/{pk}/translations/`

```json
 {
    "translations": {
        "fr-fr": {
            "name": "Taille"
        },
        "ar": {
            "name": "بحجم"
        },
        "tr-tr": {
            "name": "Beden"
        }
    }
}
```

**Response**

```json
 {
    "pk": 2,
    "key": "beden",
    "data_type": "dropdown",
    "default_value": null,
    "is_required": false,
    "is_visible": false,
    "is_searchable": false,
    "is_filterable": false,
    "is_variant": false,
    "is_variant_listable": false,
    "name": "Taille",
    "is_form_required": false,
    "is_form_field_required": false,
    "erp_code": "erp_beden",
    "pre_attribute": false,
    "description": null,
    "modified_date": "2023-01-04T18:45:59.196763Z",
    "created_date": "2021-02-23T08:46:05.164000Z",
}
```


# Media

The article highlights the API endpoints and simple methods used to add photos and videos for products on Omnitron.

On the Omnitron panels, there are Product Pictures and Product Videos sections on the detail pages of the existing or pending products in **Products and Catalogs > Product Pool** and **Integration > Pending Products**.

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2FJBsGQREkYBYLudBz8ZdS%2Fimage.png?alt=media&amp;token=56e70167-46f0-4a76-a2f4-c0076cebdc10" alt=""><figcaption></figcaption></figure>

Frontend images and videos are sent to Omnitron via API.

{% hint style="warning" %}
The accepted file formats for the images are `.png`, `.jpg`, and `.jpeg`.

To customize image dimensions, the following dynamic setting is used:

* **MAX\_IMAGE\_DIMENSIONS**

  This setting is employed to set the maximum dimensions of product images. Its purpose is to ensure that product images do not exceed specific width and height values, typically configured to maintain image quality, optimize page loads, and enhance overall performance.

  Default values are as follows:

  ```
  MAX_IMAGE_DIMENSIONS = {'WIDTH': 2000, 'HEIGHT': 2000}
  ```

  **Path:** `/api/v1/dynamic_settings/`

  **Method:** `POST`

  **Body:**

  ```json
  {
    "key": "MAX_IMAGE_DIMENSIONS",
    "value": {"WIDTH": 3000, "HEIGHT": 3000}
  }
  ```

{% endhint %}

## HTTP Methods

### `GET` Product Images

This method is used to get images of products.

Path: `/api/v1/product_image/?limit=100&product={product_pk}`

**Response**

```json
    {
  "count": 3,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 491,
      "product": 16201, #product pk
      "image": "https://{customer_omnitron_url}/products/2017/03/24/16201/7ab3a475-d208-4650-bb14-053acf955daa.jpg",
      "order": 0,
      "source":  "integration",
      "modified_date": "2022-11-25T12:06:42.954200Z",
      "created_date": "2022-11-25T12:06:42.954186Z"

    },
    {
      "pk": 493,
      "product": 16201, #product pk
      "image": "https://{customer_omnitron_url}/products/2017/03/24/16201/2906fa81-8c3e-41fa-9884-904ca431cd5e.jpg",
      "order": 1,
      "source":  "integration",
      "modified_date": "2022-11-25T12:06:42.954200Z",
      "created_date": "2022-11-25T12:06:42.954186Z"
    },
    {
      "pk": 494,
      "product": 16201, #product pk
      "image": "https://{customer_omnitron_url}/products/2017/03/24/16201/f8dc7c1e-3f5d-4cc2-965c-4aa72bf15e1f.jpg",
      "order": 2,
      "source":  "integration",
      "modified_date": "2022-11-25T12:06:42.954200Z",
      "created_date": "2022-11-25T12:06:42.954186Z"
    }
  ]
}
```

### `GET` Product Videos

This method is used to get videos of products.

Path: `/api/v1/product_video/?limit=100&product={product_pk}`

**Response**

```json
    {
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 168,
      "product": 52,
      "video": "https://{customer_omnitron_url}/product_videos/2020/06/05/814a770c-96f4-4f1e-85e4-f100ffcabc96.mp4",
      "order": 0,
      "modified_date": "2022-07-05T05:36:03.865894Z",
      "created_date": "2022-07-05T05:36:03.865865Z"
    },
    {
      "pk": 169,
      "product": 52,
      "video": "https://{customer_omnitron_url}/product_videos/2020/06/05/f77661e0-023b-4688-a43e-02c8d37ec836.mp4",
      "order": 1,
      "modified_date": "2022-07-05T05:36:03.865894Z",
      "created_date": "2022-07-05T05:36:03.865865Z"
    }
  ]
}

```

### `POST` Create Product Image

This method is used to upload images of products.

Path: `/api/v1/product_image/`

<table data-header-hidden><thead><tr><th width="218.8046875"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter</strong></td><td><strong>Detail</strong></td></tr><tr><td>product</td><td>PK information of the product with media</td></tr><tr><td>image</td><td>Image with .png or .jpeg extension</td></tr><tr><td>video</td><td>Video with .mp4 extension</td></tr><tr><td>source</td><td>Indicates what source the image came from<br>Enum field (integration or unified values)</td></tr></tbody></table>

```json
{
    "image": {File},
    "product": {product_pk},
    "source": "integration" 
}

```

**Response**

```json
{
     "pk":20026,
     "product":1,
     "image":"http://{customer_omnitron_url}/media/products/2021/05/25/1/5e0b2bc0-bee2-4ff0-a7db-9ee622510094.jpg",
     "Order":0,
     "source":  "integration",
     "modified_date": "2022-11-25T12:06:42.954200Z",
     "created_date": "2022-11-25T12:06:42.954186Z"
}
```

### `POST` Create Product Video

This method is used to upload videos of products.

Path: `/api/v1/product_video/`

```json
   {
video: {File},
"product": {product_pk}
}
```

**Response**

```json
{
    "pk":1,
    "product":1,
    "video":"http://{customer_omnitron_url}/media/product_videos/2021/05/25/6befb990-b167-4fed-9a77-b8267503cb88.mp4",
    "order":0,
    "modified_date": "2022-07-05T05:36:03.865894Z",
    "created_date": "2022-07-05T05:36:03.865865Z"
}
```

**Response / 400**

The following errors may occur if the payload of the POST request is not correct while creating an image on a product.

```json
 {
    "product": [
        "Incorrect type. Expected pk value, received unicode."
    ]
}
-- OR 
{
    "image": [
        "Upload a valid image. The file you uploaded was either not an image or a corrupted image."
    ]
}
-- OR
{
    "image": [
        "No file was submitted."
    ]
}
```

### `PATCH` Update Product Image

This method is used to change the order of the images uploaded for the product.

Path: `/api/v1/product_image/{pk}/`

```json
{   
    "pk": 20029, 
    "order": 1
}
```

**Response**

```json
{   
    "pk":20029,
    "product":1,
    "image":"http://{customer_omnitron_url}/media/products/2021/06/01/1/689df4bf-d549-45e2-aae8-f958ea357b7e.jpg",
    "order":1
}
```

### `PATCH` Update Product Video

This method is used to change the order of the videos uploaded for the product.

Path: `/api/v1/product_video/{pk}/`

```json
{   
    "pk": 20129, 
    "order": 1
}
```

**Response / 200**

If the PATCH response is successful, it returns the following response.

```json
{   
    "pk":20129,
    "product":1,
    "video":"http://{customer_omnitron_url}/media/products/2021/06/01/1/689df4bf-d549-45e2-aae8-f958ea357b7e.mp4",
    "Order":1,
    "source": null,
    "modified_date": "2023-01-03T18:42:18.358380Z",
    "created_date": "2022-11-25T12:06:42.954186Z"
}
```

**Response / 400**

Following errors may take place while updating an image on a product, if the payload of the PATCH request is not correct.

```json
 {
    "order": [
        "Ensure this value is greater than or equal to 0."#if order negative
    ]
}
```

### `DELETE` Product Image

This method is used to delete the images uploaded for the product.

Path: `/api/v1/product_image/{pk}/`

**Response**

Returns HTTP204 if the DELETE request is successful. Related product image has been deleted.

### `DELETE` Product Video

This method is used to delete the videos uploaded for the product.

Path: `/api/v1/product_video/{pk}/`

**Response**

Returns HTTP204 if the DELETE request is successful. Related product video has been deleted.

### `POST` Set the Main Image of a Product

This method is used to select the main image of the product.

Path: `/api/v1/product_image/{pk}/make_special/`

```json
{
    "_pk": 20028, 
    "special_image_type": "base", 
    "_detailed": "make_special"
}

```

**Response**

```json
{
"special_image_type":"base"
}

```

## Downloadable Image

This is the structure where the images in the ERP systems of the companies are downloaded and saved to the CDN and default storage with projects and media.

### `POST` Receive Images from ERP

These methods allow the download of product images from the ERP system.

Path: `/api/v1/downloadable_image/{product_pk}/download/`

```json
{
    "url": # ERP file url
    "image_type": #(default, swatch, picto)
    "product": "<product_pk>"
    "order": <int>,
    "source": "integration",
    "modified_date": "2017-01-23T08:33:56.794003Z",
    "created_date": "2017-01-22T23:56:28.881838Z"
}
```

**Response**

HTTP200


# Catalogue


# Introduction

**Catalogue** is an essential app that contains the products you want to sell on marketplaces or your e-commerce site. Regardless of being an e-commerce site or a marketplace, we call them **Channel**. A channel can only have one catalog but a catalog can be used by different channels.

A catalog also has to have **Catalog Items**, **Price List**, **Stock List**, and **Category Tree** in order to be sent to its Channel. They all will be explained in later stages of this documentation. Also, there are some requirements for products to be up for sale on Channels. These requirements are as follows;

* The product in the catalog has to be on the price list as well.
* The product in the catalog has to be on the stock list as well.
* The product has to be included at least one of the Category Nodes in the Category Tree.


# Price List

The name of product prices is ProductPrice. PriceList is used to create multiple lists to link to channels and similar operations. On the Shop side, when linked to the channel, the price list continues to flow without a PriceList defined in that section.

The description above is valid for the conventional loop. Multiple PriceList & StockList developments allow for the definition of multiple price lists on the basis of RetailStore.

The concept of extra price list is created to add PriceList in multiple ways. Thanks to this structure linked to the catalogs, the linked `extra_price_list` and `ProductPrice` values are sent to the shop that is matched with the relevant catalog.

## `GET` Price List

Sample HTTP request to get all price lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

**Path:** `/api/v1/price_list`

```python
import requests

url = "https://{customer_api_url}/api/v1/price_list/"
api_token = "API TOKEN"

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

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

**Response**

```json
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
          {
            "pk": 1,
            "name": "default_price_list",
            "code": "default_price_list",
            "is_auto_sync": true,
            "modified_date": "2017-01-22T12:14:44.637000Z",
            "created_date": "2017-01-22T12:14:44.637000Z",
            "currency": "try"          
            }
               ]
}

```

## `POST` Create Price List

Records new objects in the `PriceList` table. The `PriceListSerializer` class defined at `omnitron.catalogs.resources.serializers` is used to validate the data.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

**Path:** `/api/v1/price_list/`

```python
import requests

url = "https://{customer_api_url}/api/v1/price_list/"
api_token = "API TOKEN"

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

data = {
    "name": "Test List",
    "code": "test_list",
    "is_auto_sync": True
}

response = requests.post(url, headers=headers, data=data)
print(response.text)

```

**Response**

```json
{
    "pk": 2,
    "name": "Test List",
    "code": "test_list",
    "is_auto_sync": true,
    "modified_date": "2021-02-18T11:55:03.741159Z",
    "created_date": "2021-02-18T11:55:03.741139Z",
    "Currency": "try"

}
```

## `PATCH` Update Price List

Update the object specified with the primary key in the `PriceList` table.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

**Path:** `/api/v1/price_list/{PK}/`

```python
import requests

url = "https://{customer_api_url}/api/v1/price_list/{PK}/"
api_token = "API TOKEN"

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

data = {
    "name": "Test List Updated"
}

response = requests.patch(url, headers=headers, data=data)
print(response.text)
```

**Response**

```json
{
    "pk": 2,
    "name": "Test List Updated",
    "code": "test_list",
    "is_auto_sync": true,
    "currency": "try"
    "modified_date": "2021-02-18T12:02:40.890103Z",
    "created_date": "2021-02-18T11:55:03.741139Z"

}
```

## `POST` Bulk Upsert Price List

Sample HTTP post request to create multiple price lists at once. Make sure you have an acceptable dataset and file.

**Request**

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2FFCOeJgSRARGrgLEiigmd%2Fimage.png?alt=media&amp;token=bbfb9d7c-eb56-4907-bb4c-66adbedc3dc3" alt=""><figcaption></figcaption></figure>

**Path:** `/api/v1/price_list/{PK}/excel_import/`

csv file should contain the following headers and their values:

```
csv[headers]: product__sku,price, retail_price, price_list, tax_rate
csv[values]: 1, 43.2, 86.4, 1, 18.00
```

**Response**

This is an asynchronous operation and the status of the operation can be followed when it sends a `GET` request at the endpoint where it will check the status with `cache_key`. It should be noted that only 1 cache key is returned in the response.

**cache\_key:** Unique cache key to status lookup.

```
{
  "cache_key":"b6b0828c-34ec-445b-9c06-5ae060ad1029"
}
```

## Check Status with Cache Key

Checking the status of the bulk upsert process with the received cache key.

**status:** This is representing the process of excel import status and can be **waiting**, **in\_progress** and **completed**.

**chunk\_size:** In default, it is set to 100, indicating the number of times the entered line count is divided into 100-sized chunks. For example, if 300 data is entered and the chunk size is 3, it would mean that it was divided into 100-sized chunks three times.

**Path:** `/api/v1/price_list/{CACHE_KEY}/excel_import_status/`

**Waiting Status:**

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2FBzSOg1ci3nojbpd8XuCM%2Fimage.png?alt=media&amp;token=599807b5-86da-4555-81f8-e8ac30e7ac33" alt=""><figcaption></figcaption></figure>

**Completed Status:**

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2FCEJi34alX2Ma3war4QgO%2Fimage.png?alt=media&amp;token=b5bed088-a8ec-4223-8873-8cba3806d9cf" alt=""><figcaption></figcaption></figure>

**Bad Response**

If there is no valid file, this will raise the exception file\_100\_1(FileNotFoundException). Django REST's status codes and exceptions are returned because another REST is used.

```
{
    "non_field_errors": "File not found please provide an appropriate file",
    "error_code": "file_100_1"
}
```

#### Service(omnitron.catalogs.service.PriceListService)

`create_price_list:` Improvements have been made to ensure that `is_auto_sync` is True in code.

`bulk_upsert:` Improvements have been made to add multiple `ProductPrices`.

#### Channel Redirections

As mentioned above, when the relevant PriceList and Channel matching is performed, all ProductPrices linked to the relevant PriceList are sent to the Channels.

For instance;

When inspected, the method at `omnitron.channels.integrations.omniweb.integration. Integration.qs__product_price` will show a filter such as `price_listcatalogchannel=self.channel_id` . All `ProductPrices` in the select query will be sent by accessing the channel through the catalog linked to the `PriceList` and matching it with the relevant channel.

#### Data Source

Just like the principle in Channels, `ProductPrices` can be used for `DataSource`. `DataSource` is the structure that enables selling between Omnitron and creates an environment like a marketplace. It is done by direct match over the `DataSource` model.


# Stock List

Stock List consists of product stocks that store the stock information for their related products. As mentioned at “Introduction”, they are used by catalogs.

However, in some cases, a catalog can also contain extra stock lists to switch between them depending on the condition. To give an example, we can consider an app that sells from retail stores by calculating the nearest retail store to the user. In this case, you have to separate stocks by retail stores for a product and you need to use extra stock lists.

## `GET` Stock List

Sample HTTP request to get all stock lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. Retrieve `api_token` by logging in.

**Request**

Path : `/api/v1/stock_list/`

```python

import requests
url = "https://{customer_api_url}/api/v1/stock_list/"
api_token = "API TOKEN"
headers = {
'content-type': 'application/json',
'Authorization': 'Token {}'.format(api_token)
}
response = requests.get(url, headers=headers)
print(response.text)

```

**Response**

Returns all stock lists.

```json

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"name":"default_stock_list",
"code":"default_stock_list",
"is_auto_sync": true,
"modified_date":"2018-01-22T12:12:24.317000Z",
"created_date":"2018-01-22T12:12:24.317000Z"
}]
}

```

## `POST` Create Stock List

Records new objects in the `StockList` table. The `StockListSerializer` class defined at `omnitron.catalogs.resources.serializers` is used to validate the data.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/stock_list/`

```python
import requests

url = "https://{customer_api_url}/api/v1/stock_list/"
api_token = "API TOKEN"

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

data = {
    "name": "Test List"
}

response = requests.post(url, headers=headers, data=data)
print(response.text)
```

**Response**

The response status code will be `201` because a required field is specified.

```json
{
    "pk":  2,
    "name":  "Test List",
    "code":  null,
    "is_auto_sync": true,
    "modified_date":  "2021-02-19T11:54:13.241159Z",
    "created_date":  "2021-02-19T11:54:13.241139Z"
}
```

## `PATCH` Update Stock List

Update the object specified with the primary key in the `StockList` table.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. Retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/stock_list/{PK}/`

```python
import requests

url = "https://{customer_api_url}/api/v1/stock_list/{PK}/"
api_token = "API TOKEN"

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

data = {
    "name":  "Test List Updated"
}


response = requests.patch(url, headers=headers, data=data)
print(response.text)
```

**Response**

Response status code will be `200`. Updated relevant fields will be returned because the mandatory field is specified.

```json
{
    "pk":  2,
    "name":  "Test List Updated",
    "code":  null,
    "is_auto_sync": true,
    "modified_date":  "2021-02-19T11:54:13.241159Z",
    "created_date":  "2021-02-19T11:54:13.241139Z"
}
```

## `POST` Bulk Create Stock Lists

Sample HTTP post request to create multiple stock lists at once. Make sure you have an acceptable dataset and file.

**Request**

*Figure 1: Request*

Path: `/api/v1/stock_list/{PK}/excel_import/`

```
csv:product__sku,product__name,price_list__name,currency_type,tax_rate,retail_price,price2015227,GANT Man Black Sock,Demo Price List,usd,8.00,,10.00
```

**Response**

This is an asynchronous operation and the status of the operation can be followed when it sends a `GET` request at the endpoint where it will check the status with `cache_key`.

```
{
    "cache_key":"37c7dad0-1efb-4a44-b10f-a1ac619a25b1"
}
```

**Bad Response**

If there is no valid file, this will raise the exception file\_100\_1(FileNotFoundException). Status codes and exceptions of Django RESTS are returned because another REST is used.

```json
{
    "non_field_errors": "File not found please provide an appropriate file",
    "error_code": "file_100_1"
}
```

## Check Status with Cache Key

Checking the status of the bulk creation process with the received cache key.

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2FFCOeJgSRARGrgLEiigmd%2Fimage.png?alt=media&amp;token=bbfb9d7c-eb56-4907-bb4c-66adbedc3dc3" alt=""><figcaption></figcaption></figure>

**Service(omnitron.catalogs.service.StockListService)**

`create_stock_list`: A development has been made to ensure that if is\_auto\_sync *True* , located in the code.

`bulk_upsert`: A development has been made to add multiple `ProductStocks`.

**Channel Redirections**

As mentioned above, when the relevant `StockList` and `Channel` matching is performed, all ProductStocks linked to the relevant StockList are sent to the Channels.

For instance:

When inspected, the method at \`omnitron.channels.integrations.omniweb.integration. Integration.qs\_\_product\_stock will show a filter such `as _stock_list=catalog channel=self.channel`*`id`* . All `ProductStocks` in the select query will be sent by accessing the channel through the catalog linked to the StockList and matching it with the relevant channel.

**Data Source**

With a similar principle to Channels; Products and Stocks can be used for `DataSource`. `DataSource` is the structure that enables selling between Omnitron and creates an environment like a marketplace. It is done by direct match over the DataSource model.


# Catalogue Item

Allows for linking between the product and the catalog. While the product is moved to the previously created catalog, an instance is created from the `CatalogItem` model that is associated with the product and the catalog. A product can be added to multiple catalogs.

## `GET` Catalog Item

Sample HTTP request to get all catalog item lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/catalog_items/`

```python
import requests

url = "https://{customer_api_url}/api/v1/catalog_items/"
api_token = "API TOKEN"

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

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

```

**Response**

Returns the catalog ID and the product ID of the corresponding catalog item.

```json
{
    "count": n,
    "next": "/api/v1/catalog_items/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 1,
            "product": 1,
            "catalog": 1,
            "created_date": "2020-05-07T11:25:03.745360Z",
            "modified_date": "2020-05-07T11:25:03.745387Z"
        },
        {
        "..."
        }
    ]
}
```

## `POST` Create Catalog Item

After the product and catalog models are created, the post request is sent using the pk information of the relevant models. The product and catalog ID must be unique, otherwise it will throw an error. (“product”, “catalog” fields should form a unique set.)

Path: `/api/v1/catalog_items/`

```json
{
    "product": {product-pk},
    "catalog": {catalog-pk}
}

```

**Response**

Returns the properties of the created catalog items.

Response Status Code: 201 and parameter detail.

```json
{
    "pk":{catalogitem-pk},
    "product":{product-pk},
    "catalog":{catalog-pk},
    "created_date":"2021-05-11T10:46:47.996741Z",
    "modified_date":"2021-05-11T10:46:47.996769Z"
}

```

## `DELETE` Catalog Item

Path: `/api/v1/catalog_items/{catalog-item-pk}/`

**Response**

Response Status Code: `204`


# Category Trees

Category Tree is the structure where categories/subcategories are created for the products to go on sale. Category tree in Omnitron is formed by the combination of two different structures: `CategoryTree` and `CategoryNode`.

## Campaigns

On the Catalogs page **Products and Catalogs > Catalogs**, the detail page is entered through a catalog.

The **pen** icon that appears when the relevant category point is hovered with the cursor is clicked on. This opens the *Category Edit* form. Clicking on the **Campaigns** tab, and then the **Add Campaign** button, allows adding campaigns. After filling in the required information, the **Save** button at the bottom is clicked on. *Campaigns* added here are reflected on the page of the relevant sales category.

## Large Image

On the Catalogs page **Products and Catalogs > Catalogs**, the detail page is entered through a catalog.

The pen icon that appears when the relevant category point is hovered with the cursor is clicked on. This opens the Category Edit form. The **Large Image** tab is clicked on for the addition of large images. After filling in the required information, the **Save** button at the bottom is clicked on. The **Large Image** added here is reflected on the page of the relevant sales category.

## Small Image

On the Catalogs page (**Products and Catalogs > Catalogs**), the detail page is entered through a catalog.

The **pen** icon that appears when the relevant category point is hovered with the cursor is clicked on. This opens the **Category Edit Form**. The **Small Image** tab is clicked on for the addition of small images. After filling in the required information, the **Save** button at the bottom is clicked on. The **Small Image** added here is reflected on the page of the relevant sales category.

## Explanation

On the Catalogs page **Products and Catalogs > Catalogs**, the detail page is entered through a catalog.

The pen icon that appears when the relevant category point is hovered with the cursor is clicked on. This opens up the **Category Edit Form**. The details about the relevant category are entered in the description field and the **Save** button at the bottom is clicked on. The description added here is reflected on the page of the relevant sales category.

## Category Tree API Methods

### `GET` All Category Trees

Sample HTTP request to get all category trees lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/category_tree/`

```python
import requests

url = "https://{customer_api_url}/api/v1/category_tree/"
api_token = "API TOKEN"

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

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

```

**Filters**

All fields except the existing “category\_root” can be used in the `CategoryTree` model.

**Response**

```json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"name": "test catalog",
"category_root": {
"pk": 246,
"name": "test catalog",
"order": 1,
"numchild": 0,
"depth": 1
"attributes": {},
"attributes_kwargs": {},
"sort_option": null,
"uuid": "2798d37e-7a04-487f-a693-fa0c4b174656",
"path": "0001",
"created_date": "2021-10-06T13:48:07.643569Z",
"modified_date": "2021-11-01T13:54:52.526750Z"
}
}
]
}
```

### `POST` Create Category Tree

Records new objects in the CategoryTree table. The CategoryTreeSerializer class defined at `omnitron.catalogs.resources.serializers` is used to validate the data.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/category_tree/`

```python
import requests

url = "https://{customer_api_url}/api/v1/category_tree/"
api_token = "API TOKEN"

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

data = {
    "name" : "new_tree"
}

response = requests.post(url, headers=headers, data=data)
print(response.text)

```

If there is another category tree with the same name, a 400 response status code is returned.

**Response**

Information of the created `CategoryTree` object is returned. The features are described above. The status code will be 201.

```json
{
    "pk": 2,
    "name": "new_tree",
    "category_root": {
        "pk": 247,
        "name": "new_tree",
        "order": 1,
        "numchild": 0,
        "depth": 1,
        "attributes": {},
        "attributes_kwargs": {},
        "sort_option": null,
        "uuid": "06e18786-74c6-4c3c-a8dc-60e7a5dd494a",
        "path": "0002",
        "created_date": "2022-12-21T07:50:08.386058Z",
        "modified_date": "2022-12-21T07:50:08.386095Z"
    }
}

```

**Incorrect Response Example**

CategoryTree model has a name field and its property is unique=True, which means the category name field must be unique. Otherwise it will display an error as shown below.

```json
{
    "name": [
        "category tree with this name already exists."
    ]
}
```

### `PATCH` - `PUT` Update Category Tree

If not found, it returns a 404 response status code.

If a record with an existing “name” is being attempted, this returns a 400 response status code.

Path: `/api/v1/category_tree/{pk}/`

```json
{
 "name" : "new_tree__"
}
```

**Response**

```json

{
   "pk": 6,
   "name": "new_tree__",
   "category_root": {
       "pk": 247,
       "name": "new_tree",
       "order": 1,
       "numchild": 0,
       "depth": 1,
       "attributes": {},
       "attributes_kwargs": {},
       "sort_option": null,
       "uuid": "06e18786-74c6-4c3c-a8dc-60e7a5dd494a",
       "path": "0003",
       "created_date": "2022-12-21T07:50:08.386058Z",
       "modified_date": "2022-12-21T07:50:08.386095Z"
    }

}
```

**Incorrect Response Example**

If an existing tree name is inserted during the update, it will again throw a unique error for the name field.

```json
{
    "name": [
         "category tree with this name already exists."
    ]
}
```

### `DELETE` Category Tree

If the category tree is not found, it returns a 404 response status code.

If the category tree with provided ID is linked to a catalog or if there are products linked to the category tree, a 400 response status code will be returned.

Path: `/api/v1/category_tree/{pk}/`

**Response**

```
Status: 204
```

**Incorrect Response Example**

If the shop is still used by some catalog(s), the status code (406) is returned. This means Not Acceptable for deletion.

```json
{
    "non_field_errors": "Shop is still being used by some catalog(s).",
    "error_code": "category_600_6"
}
```

### `GET` Category Tree

Tree returns the relevant category tree with its sub branches. If the category tree with provided ID is not available, it returns a 404 response status code.

Path: `/api/v1/category_tree/{pk}/tree/`

**Response**

```json
[
    {
        "pk": 1,
        "name": "new_tree",
        "order": 1,
        "numchild": 8,
        "depth": 1,
        "attributes": {},
        "attributes_kwargs": {},
        "sort_option": 1,
         "uuid": "cf108732-fa7c-4f0f-9bea-fb59691a9d7c",
         "path": "0001"
    },
    {
        "pk": 4,
        "name": "Test Child",
        "order": 1,
        "numchild": 12,
        "depth": 2,
        "attributes": {
            "campaigns":  [],
            "big_image": {
                 "url": "test-child",
                 "image": "cms/2021/02/08/
                 e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                 "title": "Test Child"
            },
            "small_image": {
                "url": "test-child",
                "image":
                "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                "title": "Household Linen"
            },
            "description": ""
            },
            "attributes_kwargs": {
                 "campaigns": [],
                     "big_image": {
                        "value": {
                            "image":{
                                "url": "/media/cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                                "value": "cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                        "data_type":"image"
    }

    },
    "data_type": "nested"
},
"small_image": {
     "value": {
          "image": {
              "url": "/media/cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
              "value": "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
            "data_type": "image"                   
            }

        },
}]
```

### `GET` Category Tree Detail

Retrieves detailed information about `category_tree`. Shows details of sort option information and sorting algorithm information, as well as the associated child information in a list.

Returns the relevant category tree with its sub branches in a more detailed manner. If the category tree is not found, it returns a 404 response status code.

**Request**

```python

import requests

url = "https://{customer_api_url}/api/v1/category_tree/{PK}/tree_detailed/"
api_token = "API TOKEN"

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

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

```

Path: `/api/v1/category_tree/{pk}/tree_detailed/`

**Response**

```json

[
    {
        "pk": 1,
        "name": "Shop",
        "order": 1,
        "numchild": 8,
        "depth": 1,
         "attributes": {},
          "attributes_kwargs": {},
          "sort_option": {},
           "uuid": "cf108732-fa7c-4f0f-9bea-fb59691a9d7c",
           "path": "0001",
            "children": [
                {
                    "pk": 43,
                    "name": "Test Child",
                    "order": 1,
                    "numchild": 12,
                    "depth": 2,
                    "attributes": {
                    "campaigns": [],
                    "big_image": {
                        "url": "test-child",
                         "image": "cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                         "title": "Test Child"
                    },
                    "small_image": {
                         "url": "test-child",
                         "image": "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                         "title": "Test Child"
                    },
                    "description": ""
                },
                "attributes_kwargs": {
                     "campaigns": [],
                     "big_image": {
                         "value": {
                             "image": {
                                 "url":
                                    "/media/cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                                "value": "cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",

                        "data_type": "image"}
                    },
                    "data_type": "nested"
                },
                "small_image": {
                    "value":{
                        "image": {
                            "url": "/media/cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                            "value": "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",

                        "data_type": "image"

                }
                "data_type": "nested"
                }
            },
            "sort_option": 12,
             "uuid": "9ea60027-c3a0-4cc3-9acc-6ecc462b1589",
              "path": "00010001"
            }
        ]
    },
    {

        "pk": 43,
        "name": "Test Child",
         "order": 1,
         "numchild": 12,
         "depth": 2,
          "attributes": {
               "campaigns": [],
               "big_image": {
                   "url": "test-child",
                   "image": "cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                    "title": "Test Child"
                },
                "small_image": {
                      "url":"test-child",
                      "image": "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                       "title": "Test Child"
                },
                "description": ""
        },
        "attributes_kwargs": {
             "campaigns": [],
             "big_image": {
                      "value": {
                          "image": {
                              "url": "/media/cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",
                               "value": "cms/2021/02/08/e1f3fb64-98f2-4f8e-ad0a-4178a775c087.jpg",

                  "data_type":"image"}
            },
            "data_type": "nested"
            },
             "small_image": {
                  "value": {
                       "image": {
                           "url": "/media/cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                           "value": "cms/2021/02/08/7bcbcec5-b468-475b-b45e-e9f567151a94.jpg",
                           "data_type": "image"}
                        },
                         "data_type":"nested"}
                },
                    "sort_option": {},
                     "uuid": "9ea60027-c3a0-4cc3-9acc-6ecc462b1589",
                    "path": "00010001",
                    "children": []
        }
]
```


# Product Collection

It is provided with the `ProductCollection` model of grouping the products in catalogs or creating special collections with various rule sets. The collection type may be `Dynamic` or `Static`. Collection items are created only from items available for sale. In dynamic collections, a collection rule set is created using certain filters so that the products are dynamically added to the collection through this rule set. Dynamic collections remain active for the specified time `expiration_date` period. As long as they are not expired, the items in the collection are updated according to the rule set. This process is managed with tasks. In static collections, the items are added to the collection once and remain stable. While the created collections can be used to create special pages, they can also be used to create campaigns.

## `GET` Product Collection

Sample HTTP request to get all `product_collections` lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

```python

import requests

url = "https://{customer_api_url}/api/v1/product_collections/"
api_token = "API TOKEN"

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

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

Path: `/api/v1/product_collections/`

**Response**

```json

{
    "count": n,
    "next": "/api/v1/product_collections/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 170,
            "name": "test",
            "created_date": "2020-02-25T14:37:04.907721Z",
            "modified_date": "2021-05-07T11:35:27.751999Z",
            "collection_type": "dynamic",
            "catalog": 1,
            "is_active": true,
            "sort_option": 909,
            "uuid": "12cdaa24-31f6-4e4d-849c-93851b214b2e",
            "expiration_date": "2020-02-27T18:00:00Z",
            "value_dict": {
                "0": [
                    {
                        "value": "4",
                        "key": "active_stock__stock__gte"
                    }
                ],
                "1": [
                    {
                        "value": "True",
                        "key": "active_price__discount"
                    }
                ],
                "active_catalog_item__isnull": [
                    false
                ],
                "active_stock__isnull": [
                    false
                ],
                "active_price__isnull": [
                    false
                ]
            },
            "selected_filters": [
                {
                    "value": "4",
                    "key": "active_stock__stock__gte"
                },
                {
                    "value": "True",
                    "key": "active_price__discount"
                }
            ]
        },
        {
            "pk": 2,
            "name": "test-collection-sezgin22",
            "created_date": "2019-09-19T07:12:51.713764Z",
            "modified_date": "2020-03-31T16:11:21.606342Z",
            "collection_type": "static",
            "catalog": 1,
            "is_active": false,
            "sort_option": null,
            "uuid": "2be5902a-9dac-4720-a092-4faba04bc1a0",
            "expiration_date": null,
            "value_dict": {},
            "selected_filters": []
        },
        ...
    ]
}
```

## `POST` Creating a Static Collection

Records new objects in the `ProductCollection` table. The `ProductCollectionSerializer` class defined at `omnitron.channels.integrations.omniweb.serializers` is used to validate the data.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/product_collections/`

```python

import requests

url = "https://{customer_api_url}/api/v1/product_collections/"
api_token = "API TOKEN"

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

data = {
    "name": "test-collection-1",
    "collection_type": "static", # can be "static" or "dynamic"
    "catalog": {catalog-id}
}


response = requests.post(url, headers=headers, data=data)
print(response.text)

```

**Response**

```json

{
    "pk":{product-collection-pk},
    "name":"test-collection-1",
    "created_date":"2021-05-11T11:50:01.348381Z",
    "modified_date":"2021-05-11T11:50:01.348414Z",
    "collection_type":"static",
    "catalog":{catalog-id},
    "is_active":true,
    "sort_option":null,
    "uuid":"df9b8773-6a35-44cd-b692-8eebadc69d60",
    "expiration_date":null,
    "value_dict":{},
    "selected_filters":[]
}

```

## `POST` Add a Product to a Static Collection

Allows users to create their own product collection items. `catalog_item` and collection field IDs must be inserted.

Path: `/api/v1/product_collection_items/`

```json

{
    "catalog_item": {catalog-item-id},
    "collection":  {product-collection-id}
}
```

**Response**

```json
{
    "pk":1,
    "catalog_item": {catalog-item-od},
    "collection":{product-collection-id}
}
```

## `DELETE` Product from Static Collection

Allows users to remove specific product collection items completely. It returns "204 No Content"

Path: `/api/v1/product_collection_items/{product-collection-item-id}`

**Response Status Code:** `204`

## `POST` Create Dynamic Collection

Allows users to create their own product collections. Dynamic refers users to add dynamic filters and automatically find and add products that fit into filters. Users can mark these collections as active or inactive, by default `is_active` is true.

Path: `/api/v1/product_collections/`

```json
{
    "collection_type": "dynamic",
     "is_active": true,
     "name": "test",
     "catalog": {catalog-id},
     "expiration_date": "2021-05-12T15:27+0300"
}
```

**Response**

```json
{
    "pk":1359,
    "name":"test",
    "created_date":"2021-05-11T12:27:09.239906Z",
    "modified_date":"2021-05-11T12:27:09.239932Z",
    "collection_type":"dynamic",
    "catalog":{catalog-id},
    "is_active":true,
    "sort_option":null,
    "uuid":"831174d8-ebb9-4cd2-aad1-00011ca056cf",
    "expiration_date":"2021-05-12T15:27:00+03:00",
    "value_dict":{},
    "selected_filters":[]
}
```

## `PATCH` Update a Dynamic Collection

Update can be performed for collections with `PATCH` Patch operations. The following request is an example of a rule set assignment for a dynamic collection.

Path: `/api/v1/product_collections/{product-collection-id}`

```json
{
   "value_dict":{
      "active_categories__category":{category-id}
   },
   "selected_filters":[
      {
         "name":"Test Category",
         "value":{catergory-id},
         "key":"active_categories__category",
         "label":"Category",
         "dumpedLabel":"Category"
      }
   ]
}
```

## `DELETE` Collection

With the deletion request, the collection is deactivated but not completely removed from the system.The sample `is_active` parameter is updated to false because the `perform_destroy` method of the `ProductCollectionViewSet` is overridden.

Path: `/api/v1/product_collections/{product-collection-pk}/`

**Response Status Code:** 204

## `GET` List All Products in a Collection

Path: `/api/v1/product_collections/{product-collection-pk}/item_list`

The endpoint where the products in the collection are listed so all the products belonging to this collection are listed. Listing is done by calling the `item_list` method of the `ProductCollectionViewSet`.

**Response**:

```json
{
    "count": n,
    "next": "/api/v1/product_collections/1357/item_list/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 856,
            "name": "WEDGIE ALPARGATA FUCHSIA",
            "base_code": "1115101",
            "sku": "1115101003",
            "product_type": {
                "value": "0",
                "label": "Simple"
            },
            "is_active": false,
            "parent": 217740,
            "attributes": {
                "erp_MalDetayAdi": "WEDGIE",
                "integration_AsilRenk": "FUCHSIA"
            },
            "attributes_kwargs": {},
            "extra_attributes": {},
            "active_catalog_item": {
                "pk": 18,
                "active_collection_item": null
            },
            "active_price": {
                "pk": 12,
                "price": "100.00",
                ...
            },
            "active_stock": {
                "pk": 229,
                "stock": 100,
                "unit_type": "qty"
            },
            "active_categories": [
                {
                    "pk": 19,
                    "category": {
                        "pk": 7,
                        ...
                    }
                }
            ],
            "productimage_set": [
                {
                    "pk": 111635,
                    "status": "active"
                    ...
                },

            ],
            "attribute_set": {
                "pk": 2,
                "name": "Shoe"
            }
        }
    ]
}
```

## `GET` List All Addable Products for a Collection

Path: `/api/v1/product_collections/{product-collection-pk}/product_list/`

The endpoint where the products that can be added in the collection are listed. Listing is done by calling the `product_list` method of the `ProductCollectionViewSet`.

**Response:**

```json
{
    "count": 758,
    "next": "api/v1/product_collections/1357/product_list/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 3,
            "name": "Guitar",
            "base_code": "1020583",
            "sku": "1020583031",
            "product_type": {
                "value": "0",
                "label": "Simple"
            },
            "is_active": true,
            "parent": null,
            "attributes": {},
            "attributes_kwargs": {},
            "extra_attributes": {},
            "active_catalog_item": {
                "pk": 3383,
                "active_collection_item": null
            },
            "active_price": {
                "pk": 39,
                "price": "120.00",
                "currency_type": "usd"
            },
            "active_stock": {
                "pk": 1,
                "stock": 83,
                "unit_type": "qty"
            },
            "active_categories": [
                {
                    "pk": 67,
                    "category": {
                        "pk": 4,
                        ...
                    }
                }
            ],
            "productimage_set": [],
            "attribute_set": {
                "pk": 151,
                "name": "New feature set"
            }
        }
    ]
}

```


# Product Sorting

## Product Sorting API Methods

The `SortingAlgorithm` model ensures that the products in the categories and collections are sorted according to a certain algorithm. Sorting types can be `static`, `dynamic` or `external`. When the static sorting algorithms are used for the catalog or collection, the products are sorted statically without depending on other conditions. In dynamic sorting algorithms, a sorting rule set is created by using certain filters so that the products in the catalog or collection are renewed and sorted according to the determined rule set. External sorting algorithms sort by the saved rules with a file.

### `GET` Sorting Algorithms

Sample HTTP request to retrieve all sorting algorithm lists from the system with their details.

‘content\_type’ header represents the response type.

The "Authorization" header is required for authentication. You can retrieve api\_token by logging in.

Path: `/api/v1/sorting_algorithms/`

**Request**

```python
import requests

url = "https://{customer_api_url}/api/v1/sorting_algorithms/"
api_token = "API TOKEN"

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

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

**Response**

In response, it returns the sorting algorithm details. The rule set that comes in the response also contains the rules of the relevant dynamic sorting.

```json

{
    "count": n,
    "next": "/api/v1/sorting_algorithms/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 1,
            "code": "a0001",
            "name": "Default",
            "sorting_type": "dynamic",
            "ruleset": [
                {
                    "rule_type": "sorter",
                    "exp": [
                        {
                            "field": "priority"
                        }
                    ],
                    "order": "desc",
                    "mode": "max",
                    "path": "r0001"
                },
                {
                    "rule_type": "sorter",
                    "exp": [
                        {
                            "field": "listed_id"
                        }
                    ],
                    "order": "desc",
                    "mode": "max",
                    "path": "r0002"
                }
            ],
            "config": {},
            "is_visible": true,
            "catalog": 1
        }
    ]
}

```

### `POST` Create Sorting Algorithm

Records new objects in the `SortingAlgorithm` table. The `SortingAlgorithmSerializer` class defined at `omnitron.search.resources.serializers` is used to validate the data.

**Request**

Path: `/api/v1/sorting_algorithms/`

```python
import requests

url = "https://{customer_api_url}/api/v1/sorting_algorithms/"
api_token = "API TOKEN"

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

data = {
    "sorting_type":"dynamic",
    "is_visible":False,
    "name":"test algorithm",
    "catalog":{catalog-id},
    "ruleset":[
        {
            "rule_type":"sorter",
            "exp":[{"field":"attributes__max_installment"}],
            "order":"desc"
        },
        {
            "rule_type":"sorter",
            "exp":[{"field":"stock"}],
            "order":"desc"
        }]
}

response = requests.post(url, headers=headers, data=data)
print(response.text)


```

**Response**

Returns the created sorting algorithm items properties. Response Status Code: 201

```json
{
    "pk": 41,
    "code": "a0009",
    "name": "test algorithm",
    "sorting_type": "dynamic",
    "ruleset": [
        {
            "rule_type": "sorter",
            "exp": [
                {
                    "field": "attributes__max_installment"
                }
            ],
            "order": "desc",
            "mode": "max",
            "path": "r0001"
        },
        {
            "rule_type": "sorter",
            "exp": [
                {
                    "field": "stock"
                }
            ],
            "order": "desc",
            "mode": "sum",
            "path": "r0002"
        }
    ],
    "config": {},
    "is_visible": false,
    "catalog": {catalog-id},
    "modified_date": "2022-12-22T09:54:31.076718Z",
    "created_date": "2022-12-22T09:54:31.076685Z"
}
```

### `PATCH` Update Sorting Algorithm

Update the object specified with the primary key in the `SortingAlgorithm` table.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

Path: `/api/v1/sorting_algorithms/{sorting-algorithm-pk}`

```python

import requests

url = "https://{customer_api_url}/api/v1/sorting_algorithms/{PK}/"
api_token = "API TOKEN"

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

data = {
    "sorting_type":"static",
    "is_visible":True,
    "name": "Test Updated"
}

response = requests.patch(url, headers=headers, data=data)
print(response.text)
```

**Response**

```json
{
    "pk": 41,
    "code": "a0009",
    "name": "Test Updated",
    "sorting_type": "static",
    "ruleset": [
        {
            "rule_type": "sorter",
            "exp": [
                {
                    "field": "attributes__max_installment"
                }
            ],
            "order": "desc",
            "mode": "max",
            "path": "r0001"
        },
        {
            "rule_type": "sorter",
            "exp": [
                {
                    "field": "stock"
                }
            ],
            "order": "desc",
            "mode": "sum",
            "path": "r0002"
        }
    ],
    "config": {},
    "is_visible": true,
    "catalog": 1,
    "modified_date": "2022-12-22T10:14:56.911146Z",
    "created_date": "2022-12-22T09:54:31.076685Z"
}

```

### `GET` List All Addable Products for the Algorithm

Path: `/api/v1/sorting_algorithms/{sorting-algorithm-pk}/product_list/`

The endpoint where the products that can be added to the algorithm are listed. Essentially, it returns products added for static sorting.

**Response**

```json

{
    "count": n,
    "next": "/api/v1/sorting_algorithms/{sorting-algorithm-pk}/product_list/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 468,
            "name": "VEST / SWEATER",
            "base_code": "1182701",
            "sku": "1182701040",
            "product_type": "0",
            "is_active": true,
            "parent": 210347,
            "attributes": {
                "erp_ProductDetailName": "NYLON",
                "integration_MainColour": "EVERGREEN"
            },
            "attributes_kwargs": {},
            "extra_attributes": {},
            "group_products": [],
            "productimage_set": []
            ...
        }
    ]
}

```

### `GET` List All Products in an Algorithm

Sample HTTP request to return the entire list of items linked to sorting algorithms.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/sorting_algorithms/{sorting-algorithm-pk}/item_list/`

The endpoint where the products in the algorithm are listed.

```python

import requests

url = "https://{customer_api_url}/api/v1/sorting_algorithms/{PK}/item_list/"
api_token = "API TOKEN"

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

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

```

**Response**

```json
{
    "count": n,
    "next": "/api/v1/sorting_algorithms/{sorting-algorithm-pk}/item_list/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 468,
            "name": "VEST / SWEATER",
            "base_code": "1182701",
            "sku": "1182701040",
            "product_type": "0",
            "is_active": true,
            "parent": 210347,
            "attributes": {
                "erp_ProductDetailName": "NYLON",
                "integration_MainColour": "EVERGREEN"
            },
            "attributes_kwargs": {},
            "extra_attributes": {},
            "group_products": [],
            "productimage_set": []
            ...
        }
    ]
}

```

## Sort Option API Methods

By saving the sorting score produced by the Sorting Algorithm, it allows Elasticsearch to sort according to this value for the shop.

### `GET` Sort Options

Sample HTTP request to get all sort options lists with its details from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

Path: `/api/v1/sort_options/`

**Request**

```python
import requests

url = "https://{customer_api_url}/api/v1/sort_options"
api_token = "API TOKEN"

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

response = requests.patch(url, headers=headers)
print(response.text)

```

**Response**

Returns the sort options details. Sorting algorithm ID values are kept in the responses, and optional channel information can be added.

```json
{
    "count": n,
    "next": "/api/v1/sort_options/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 12,
            "channel": null,
            "sorting_algorithms": [
                25,
                703,
                40
            ],
            "label": "Demo Sub Category",
            "value": "6d9fe140-a02f-4470-9989-f8e4303c9751",
            "order": null,
            "is_default": false,
            "is_visible": false,
            "translations": null,
            "catalog": {catalog-id},
            "disable_score": false
        }
    ]
}
```

### `POST` Create Sort Option

Records new objects in the `SortOption` table. The `SortOptionSerializer` class defined at `omnitron.search.resources.serializers` is used to validate the data.

**Request**

Path: `/api/v1/sort_options/`

```json
{
    "channel": null,
    "sorting_algorithms": [
        {sorting-algorithm-pk},
        ...
    ],
    "label": "label",
    "order": null,
    "is_default": false,
    "is_visible": false,
    "catalog": {catalog-pk},
    "disable_score": false
}

```

**Response**

```json
{
    "pk": 12,
    "channel": null,
    "sorting_algorithms": [
        {sorting-algorithm-pk},
        ...
    ],
    "label": "label",
    "order": null,
    "is_default": false,
    "is_visible": false,
    "catalog": {catalog-pk},
    "disable_score": false
}
```

### `POST` Add Sorting Algorithms to Sort Option

To add an extra sorting algorithm to the sorting options, the relevant endpoint is used and the `sorting_algorithm` and options IDs to be added must be entered. The sent data information list should be sent. In addition, a sort option can only have one static algorithm.

**Request**

Path: `/api/v1/sort_options/{sort-option-pk}/add_sorting_algorithms/`

**Data**

```json
[
    {
        "algorithm": {sorting-algorithm-pk},
        "option": {sort-option-pk}
    }
]
```

**Response**

```json
{
    "pk": 12,
    "channel": null,
    "sorting_algorithms": [
        {sorting-algorithm-pk},
        ...
    ],
    "label": "label",
    "order": null,
    "is_default": false,
    "is_visible": false,
    "catalog": {catalog-pk},
    "disable_score": false
}

```

**Bad Response**

If a static algorithm is not entered, it will throw an error as follows:

Static code is 400 (Bad Response)

```json
[
    {
        "non_field_errors": [
            "A sort option can only have one static algorithm!"
        ]
    }
]
```

## Product Sorting Item API Methods

It is the model with the score calculated by the sorting algorithm of the product. The sorting score is calculated by the linked algorithm.

### `GET` Product Sorting Items

Sample HTTP request to get all product sorting items lists from the system.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve api\_token by logging in.

**Request**

Path: `/api/v1/product_sorting_items/`

```python

import requests

url = "https://{customer_api_url}/api/v1/product_sorting_items"
api_token = "API TOKEN"

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

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

**Response**

```json

{
    "count": n,
    "next": "/api/v1/product_sorting_items/"
    "previous": null,
    "results": [
        {
            "pk": 8769,
            "catalog_item": {catalog-item-pk},
            "sorting_algorithm": {sorting-algorithm-pk},
            "modified_date": "2021-10-15T07:21:14.937432Z",
            "created_date": "2021-10-15T07:21:14.937362Z"
        },
        ...
    ]
}

```

### `POST` Create Product Sorting Items

Records new objects in the ProductSortingItem table. The ProductSortingItemSerializer class defined at omnitron.resources.serializers is used to validate the data.

‘content\_type’ header represents the response type.

The ‘Authorization’ header is required for authentication. You can retrieve `api_token` by logging in.

**Request**

Path: `/api/v1/product_sorting_items/`

```python

import requests

url = "https://{customer_api_url}/api/v1/product_sorting_items"
api_token = "API TOKEN"

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

data = {
    "catalog_item": {catalog-item-pk},
    "sorting_algorithm": {sorting-algorithm-pk}
}


response = requests.post(url, headers=headers, data=data)
print(response.text)
```

**Response**

```json

{
    "pk":12,
    "catalog_item":{catalog-item-pk},
    "sorting_algorithm":{sorting-algorithm-pk}
}

```

### `DELETE` Product Sorting Items

Allows users to completely remove certain product sorting items. Returns "204 No Content"

Path: `/api/v1/product_sorting_items/{product-sorting-item-pk}/`

**Response Status Code:** 204


# Channels


# Introduction

The concept of omnichannel in e-commerce has an important place today. “Omnichannel E-Commerce” means the management and execution of all different commercial activity channels, from the website to mobile applications, from stores to marketplaces, through the same infrastructure, and platform.

Akinon allows all brands using its infrastructure to sell each other's products through these channels and adds the "Unified" feature, which offers an internal marketplace environment, offering the flexibility to manage all channels with a central infrastructure.

Defining and integrating channels through Omnitron, which is a back-office application, increases channel diversity and provides channel-based and inter-channel e-commerce management. Channel-based strategies can be implemented with campaign rules set up specifically for channels.


# Payments

The Omnitron module where the payments and their configurations are stored. POS, Bank,Card, CardType, MultiCurrencyCard, BinNumber, Installment, PaymentOption and BankAccount models are in the payments application. Virtual POS settings to be used on webshop and mobile platforms, management of bank settings, defining new card types and management of their settings, payment options such as credit-card, cash-register etcCredit and debit card settings can be managed using different checkout providers through the payments application.

## POS

Stores the settings of the virtual POS you will use on your website or mobile application. It can be accessed from the Sales Channels > Payment Management > Add/Edit POS Integration menu on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` POS

Retrieves attribute values from the POS table. Gets the filter parameters with `{omnitron.payments.resources.filters.PosFilter}` in PosFilter as query parameters. Supports pagination by inheriting ViewSet from ListModelMixin with query parameters of page=X and limit=Y.

Path: `/api/v1/pos/`

Filters: Filtering can only be done with `channel`, `id` and `modified_date`.

Example: `?channel=1`

**Response**

```json
{
   "count": 1,
   "next": "/api/v1/pos/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": " Test Garanti Pay",
           "slug": "gpay",
           "gateway": "omnicore.libs.payment_gateways.gpay.GPayGateway",
           "config": {
               "auth": {
                   "password": "111111",
                   "merchant_id": "111111",
                   "terminal_id": "111111",
                   "prov_username": {
                       "oos": "oos",
                       "refund": "refund"
                   }
               },
               "mode": "TEST",
               "version": "v0.01",
               "store_key": "111111",
               "refund_url": "https://sanalposprovtest.garanti.com.tr/VPServlet",
               "company_name": "AAA",
               "timeout_period": 300
           },
           "resource_url": "https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine",
           "three_d_resource_url": null,
           "channel": 1,
           "gateway_display": "Gpay",
           "modified_date": "2022-02-10T06:28:55.575801Z",
           "created_date": "2022-02-10T06:28:55.575773Z"
       }
   ]
}
```

### `POST` Create POS

Adds a new record to the POS table. Verified with PosSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the registration process.

Path: `/api/v1/pos/`

```json
{
   "name": "POS",
   "slug": "POS",
   "gateway": "omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
   "config": {
               "three_d_enabled": false,
               "fail_on_void": false,
               "auth": {},
               "fail_on_refund": false
           },
   "resource_url": "https://dummypay.net/",
   "three_d_resource_url": "https://dummypay.net/",
   "channel": 1
}
```

**Response**

The success response status is HTTP201 and the response body contains the generated POS information HTTP400 and HTTP406 response statuses mean that the POS object was not created.

```
Status 201
```

```json
{
   "pk": 11,
   "name": "POS",
   "slug": "POS",
   "gateway": "omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
   "config": {
       "three_d_enabled": false,
       "fail_on_refund": false,
       "fail_on_void": false,
       "auth": {}
   },
   "resource_url": "https://dummypay.net/",
   "three_d_resource_url": "https://dummypay.net/",
   "channel": 1,
   "gateway_display": "Dummypay",
   "modified_date": "2023-01-13T11:08:43.792169Z",
   "created_date": "2023-01-13T11:08:43.792140Z"
}
```

**Errors**

```
Status 400
```

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```

```
Status 406
```

```json
{
   "non_field_errors": "{"username": ["This field is required."], "store_key": ["This field is required."], "password": ["This field is required."], "client_id": ["This field is required."]}",
   "error_code": "pos_100_2"
}
```

### `GET` POS Detail

Retrieves the object of the corresponding primary key from the POS table. If it cannot find the object, it returns HTTP404.

Path: `/api/v1/pos/{id}/`

Returns POS information with the provided ID.

**Response**

Successful response status is HTTP200 and response BODY is the details of the object.

```json

{
           "pk": 1,
           "name": " Test Garanti Pay",
           "slug": "gpay",
           "gateway": "omnicore.libs.payment_gateways.gpay.GPayGateway",
           "config": {
               "auth": {
                   "password": "111111",
                   "merchant_id": "111111",
                   "terminal_id": "111111",
                   "prov_username": {
                       "oos": "oos",
                       "refund": "refund"
                   }
               },
               "mode": "TEST",
               "version": "v0.01",
               "store_key": "111111",
               "refund_url": "https://sanalposprovtest.garanti.com.tr/VPServlet",
               "company_name": "AAA",
               "timeout_period": 300
           },
           "resource_url": "https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine",
           "three_d_resource_url": null,
           "channel": 1,
           "gateway_display": "Gpay",
           "modified_date": "2023-01-13T11:08:43.792169Z",
           "created_date": "2023-01-13T11:08:43.792140Z"
}
```

### `DELETE` POS

Path: `/api/v1/pos/{id}/`

Permanently deletes POS with the provided ID.

**Response:** Only returns status 204 in response

### `PATCH`-`PUT` Update POS

Path: `/api/v1/pos/{id}/`

POS information with the provided ID is updated.

Request

```json
{
    "Pk":1,
    "name":"DummyPay",
    "Slug":"dummy-pay",
    "gateway":"omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
    "Config":{
        "Three_d_enabled":false,
        "Fail_on_void":false,
        "Fail_on_refund":false
    },
    "resource_url":"https://dummypay.net/",
    "three_d_resource_url":"https://dummypay.net/",
    "Channel":1,
    "gateway_display":"Dummypay"
}
```

**Response**

```json
{
    "Pk":10,
    "name":"DummyPay",
    "Slug":"dummy-pay",
    "gateway":"omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
    "Config":{
        "Three_d_enabled":false,
        "Fail_on_refund":false,
        "Fail_on_void":false,
        "Auth":{}
    },
    "resource_url":"https://dummypay.net/",
    "three_d_resource_url":"https://dummypay.net/",
    "Channel":1,
    "gateway_display":"Dummypay",
    "modified_date": "2023-01-13T11:37:10.547812Z",
    "created_date": "2023-01-13T11:08:43.792140Z"
}
```

**Errors**

```json
-- OR 406
{
    "non_field_errors": "Channel: Shop of Pos: dummy_pos cannot change.",
    "error_code": "pos_100_3"
}
-- OR 406
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
-- OR 406
{
   "non_field_errors": "{"username": ["This field is required."], "store_key": ["This field is required."], "password": ["This field is required."], "client_id": ["This field is required."]}",
   "error_code": "pos_100_2"
}
```

### `GET` Schema Structure

Path: `/api/v1/pos/schema/`

Returns the schema structure for the POS endpoint.

```json
{
    "name": "Schema",
    "description": "",
    "renders": [
        "application/json",
        "text/html",
        "text/csv",
        "application/xls",
        "application/xml"
    ],
    "parses": [
        "application/json",
        "application/x-www-form-urlencoded",
        "multipart/form-data"
    ],
    "actions": {
        "POST": {
            "pk": {
                "type": "integer",
                "required": false,
                "read_only": true,
                "label": "ID"
            },
            "name": {
                "type": "string",
                "required": true,
                "read_only": false,
                "label": "Name",
                "max_length": 64
            },
            "slug": {
                "type": "string",
                "required": true,
                "read_only": false,
                "label": "Slug"
            },
            "gateway": {
                "type": "choice",
                "required": true,
                "read_only": false,
                "label": "Gateway",
                "choices": [
                    {
                        "display_name": "alpha",
                        "value": "omnicore.libs.payment_gateways.alpha.AlphaGateway"
                    },
                ]
            },
            "config": {
                "type": "json field",
                "required": false,
                "read_only": false,
                "label": "Config",
                "choices": {
                    "fiba_credit": {
                        "client_id": {
                            "type": "string",
                            "required": true,
                            "read_only": false,
                            "label": "Client Id",
                            "max_length": 64
                        },
                        "client_secret": {
                            "type": "string",
                            "required": true,
                            "read_only": false,
                            "label": "Client Secret Key",
                            "max_length": 64
                        },
                        ...
            },
            "resource_url": {
                "type": "url",
                "required": true,
                "read_only": false,
                "label": "Resource url",
                "max_length": 200
            },
            "three_d_resource_url": {
                "type": "url",
                "required": false,
                "read_only": false,
                "label": "Three d resource url",
                "max_length": 200
            },
            "channel": {
                "type": "pk field",
                "required": true,
                "read_only": false,
                "label": "Channel"
            },
            "gateway_display": {
                "type": "method field",
                "required": false,
                "read_only": true,
                "label": "Gateway display"
            },
            "modified_date": {
                "type": "datetime",
                "required": false,
                "read_only": true,
                "label": "Modified date"
            },
            "created_date": {
                "type": "datetime",
                "required": false,
                "read_only": true,
                "label": "Created date"
            }
        }
    },
    "filters": {
        "id": {
            "type": "NumberFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte"
            ]
        },
        "channel": {
            "type": "ModelChoiceFilter",
            "lookup_types": [
                "exact"
            ]
        },
        "modified_date": {
            "type": "DateFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte",
                "date"
            ]
        },
        "pk": {
            "type": "NumberFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte"
            ]
        }
    },
    "ordering": "__all__"
}
```

## Bank

Permits bank definitions on Omnitron. It can be accessed from the Sales Channels > Payment Managements > Banks menu on Omnitron.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable 
```

***

### `GET` Banks

Path: `/api/v1/banks/`

Returns the recorded banks in Omnitron.

**Response**

```json
{
    "count": 29,
    "next": "http://localhost:8000/api/v1/banks/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 2,
            "name": "Türkiye Finans Katılım Bankası",
            "slug": "turkiye-finans-katlm-bankas",
            "logo": null,
            "channel": 1,
            "modified_date": "2017-02-01T14:18:17.752654Z",
            "created_date": "2017-02-01T14:18:17.752631Z"
        },
…
}
```

**Filters**

Filtering can only be made with channel, ID and modified\_date.

`/api/v1/banks/?channel=1`

**Response**

```json

{
   "count": 1,
   "next": "/api/v1/banks/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Test Bank",
           "slug": "test-bank",
           "logo": null,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.752654Z",
           "created_date": "2017-02-01T14:18:17.752631Z"
       }]
}
  
```

### `POST` Create Bank

Path: `/api/v1/banks/`

Adds a new record to the Bank table. It is validated with BankSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

```json
{
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1
}  
```

**Response**

HTTP 200

```json
{
   "pk": 2,
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
    "modified_date": "2023-01-13T13:28:34.304746Z",
    "created_date": "2023-01-13T13:28:34.304708Z"
}
```

**Errors**

```json
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
```

### `GET` Bank Detail

Path: `/api/v1/banks/{id}/`

Returns bank information with the provided ID.

**Response**

```json
{
   "pk": 2,
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
   "modified_date": "2023-01-13T13:28:34.304746Z",
   "created_date": "2023-01-13T13:28:34.304708Z"
}
```

### `DELETE` Bank

Path: `/api/v1/banks/{id}/`

Permanently deletes banks with the provided ID.

**Response**

Only returns status `204` in response.

### `PUT`-`PATCH` Update Bank

Path: `/api/v1/banks/{id}/`

Permits changes to banks with the provided ID.

```json
{
   "name": "Edited Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1
}
```

**Response**

```json
{
   "pk": 2,
   "name": "Edited Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
   "modified_date": "2023-01-13T13:31:55.092127Z",
   "created_date": "2023-01-13T13:31:29.377205Z"
}
```

**Errors**

```json
HTTP 400
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
-- OR HTTP 406
{
    "non_field_errors": "Channel: Test Edited of Bank: test-bank cannot change.",
    "error_code": "bank_100_2"
}
```

### `POST` Bulk Bank Creation

Path: `/api/v1/banks/bulk_create/?channel_id={channel_id}`

Permits the bulk creation of banks with the CSV file. It is mandatory to provide channel ID as a query parameter. The fields in BankSerializer must be present in the CSV file. The logo must be expressed within the URL.

```json
{
    filename: csv_file.csv
}
```

**Response**

```json
{
    "<name>": "<Creation status>"
}
```

## Card Type

Used for the type identification of the cards to be defined on Omnitron. It can be accessed from the **Sales Channels > Payment Management > Card Types** menu on Omnitron.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` Credit Card Types

Path: `/api/v1/card_types/`

Returns the card types registered on Omnitron.

**Filters**

Filtering can only be done with channel, ID and modified\_date.

`/api/v1/card_types/?channel=1`

**Response**

```json
{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/card_types/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Bonus",
           "slug": "bonus",
           "logo": "http://logo.url",
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.763175Z",
           "created_date": "2017-02-01T14:18:17.763148Z"
       }]
}
```

### `GET` Credit Card Type Detail

Path: `/api/v1/card_types/{id}/`

Returns card types with the provided ID.

**Response**

```json
{
   "pk": 1,
   "name": "Bonus",
   "slug": "bonus",
   "logo": "http://logo.url.jpg",
   "channel": 1,
   "modified_date": "2017-02-01T14:18:17.763175Z",
   "created_date": "2017-02-01T14:18:17.763148Z"
}   
```

### `DELETE` Credit Card Type

Path: `/api/v1/card_types/{id}/`

Permanently deletes card types with the provided ID.

**Response**

Only returns status `204` in response

### `PUT`-`PATCH` Update Credit Card Type

Path: `/api/v1/card_types/{id}/`

Updates card types with the provided ID.

```json

{
   "pk": 1,
   "name": "Bonus-v2",
   "slug": "bonus",
   "channel": 1
}
   
```

**Response**

```json

{
   "pk": 1,
   "name": "Bonus-v2",
   "slug": "bonus",
   "logo": "http://logo.url",
   "channel": 1
}
   
```

**Errors**

```json
{
   "logo": [
       "The submitted data was not a file. Check the encoding type on the form."
   ]
}
-- OR
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
-- OR HTTP 406
{
    "non_field_errors": "Channel: test of CardType: test cannot change.",
    "error_code": "card_type_100_2"
}
```

### `POST` Create a New Card Type

Adds a new record to the CardType table. Validated with CardTypeSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the recording process.

Path: `/api/v1/card_types/`

```json

{
   "name": "New Type",
   "slug": "new-type",
   "logo": "<logo file>",
   "channel": 1
}

```

**Response**

HTTP 200

```json

{
   "pk": 2,
   "name": "New Type",
   "slug": "new-type",
   "logo": "http://logo.url",
   "channel": 1,
    "modified_date": "2023-01-13T14:30:39.534199Z",
    "created_date": "2023-01-13T14:30:39.534173Z"
}

```

**Response**

HTTP 400

```json

{
   "logo": [
       "The submitted data was not a file. Check the encoding type on the form."
   ]
}
-- OR
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
```

## Card

Used to define and process cards that can be used in sales channels on Omnitron. Creating a card firstly requires the creation of a card type, POS and the bank to which it will be linked. It can be accessed from the Sales Channels > Payment Management > Card Settings menu on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

### `GET` All Credit Cards

Path: `/api/v1/cards/`

Returns all cards registered in the system.

**Filters**

Location: `Omnitron.payments.resources.filters.CardFilter`

Filtering can be performed with all fields available in the Card model.

Example: `?name=Bonus&bank=2`

**Response**

```json

{
   "count": 1,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Bonus",
           "bank": 2,
           "card_type": 1,
           "card_payment_type": "credit",
           "cash_payment": 10,
           "installment_payment": 2,
           "slug": "bonus",
           "three_d_payment": 10,
           "is_commerce_card": false,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.776010Z",
           "created_date": "2017-02-01T14:18:17.775977Z"
       }
   ]
}

```

### `GET` Card Detail

Path: `/api/v1/cards/{id}/`

Returns card information with the provided ID.

**Response**

```json

{
   "pk": 1,
   "name": "Bonus",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "bonus",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2017-02-01T14:18:17.776010Z",
   "created_date": "2017-02-01T14:18:17.775977Z"
}
```

### `PUT`-`PATCH` Update Card

Path: `/api/v1/cards/{id}/`

Updates the card information with the provided ID.

```json

{
   "pk": 1,
   "name": "New Card",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new-card",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1
}

```

**Response**

```json
{
   "pk": 1,
   "name": "New Card",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new-card",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2023-01-16T07:35:04.404826Z",
   "created_date": "2023-01-16T07:25:39.965970Z"
}
```

**Response / 400**

```json

{
   "non_field_errors": [
       "The fields slug, channel, bank, card_type must make a unique set.",
       "The fields bank, card_type, card_payment_type must make a unique set."
   ]
}
```

**Response / 406**

```json

{
   "non_field_errors": "Card: <bank> <card_tpye> <bank_slug> <channel_name> incompatible.",
   "error_code": "card_100_2"
}

```

### `POST` Create Card

Adds a new record to the card table. Verified with CardSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the registration process.

Path: `/api/v1/cards/`

```json

{
   "name": "new",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "debit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1
}

```

**Response / 201**

```json
{
   "pk": 2,
   "name": "new",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "debit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2023-01-16T07:25:39.965998Z",
   "created_date": "2023-01-16T07:25:39.965970Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel, bank, card_type must make a unique set.",
       "The fields bank, card_type, card_payment_type must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Card: <bank> <card_tpye> <bank_slug> <channel_name> incompatible.",
   "error_code": "card_100_2"
}
```

### `DELETE` Credit Card

Path: `/api/v1/cards/{id}/`

Permanently deletes cards with the provided ID.

Returns status `204` in response.

### `POST` Bulk Card Creation

Path: `/api/v1/cards/{id}/bulk_create/`

Used to bulk create BIN numbers for cards with the provided ID. The CSV file is a single column and contains the BIN number. For this process, it uses the `bulk_create` function of `BinNumberService`.

```
{
    filename: csv_file.csv
}
```

**Response**

```json
{
    "<bin_number>": "<Creation status>" 
}
```

**HTTP 406**

```json
{
    "non_field_errors": "File not found please provide an appropriate file",
    "error_code": "file_100_1"
}
```

## Bank Identification Number

The BIN that can be shopped within sales channels are defined. Each BIN is linked to a card. The match is made when the card information is entered in the sales channels. When we enter the details of a card on the Sales Channels>Payment Management>Card Settings page on the Omnitron panel, the bottom of the opened page displays a table with the title Card BIN Numbers.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All BINs​

Path: `/api/v1/bin_numbers/`

Returns all BIN numbers registered on Omnitron.

**Filters**

Filters can be applied to bin\_number\_length (6 or 8) in addition to all fields on the serializer. E.g.: `?card=1`

**Response**

```json

{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/bin_numbers/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "bin_number": "524659",
           "card": 5,
           "is_active": true,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.782154Z",
           "created_date": "2017-02-01T14:18:17.782137Z"
       }]
}

```

### `GET` BIN by ID

Path: `/api/v1/bin_numbers/{id}/`

Returns BIN numbers with the provided ID.

**Response**

```json

{
   "bin_number": "524659",
   "card": 5,
   "is_active": false,
   "channel": 1,
   "bin_number_length": "6",
   "modified_date": "2017-02-01T14:18:17.782154Z",
   "created_date": "2017-02-01T14:18:17.782137Z"
}
```

### `POST` Create BIN

Path: `/api/v1/bin_numbers/`

It is used to create BIN numbers.

```json

{
   "bin_number": "123452",
   "card": 5,
   "is_active": true,
   "channel": 1
}

```

**Response / 200**

```json

{
   "pk": 724,
   "bin_number": "123452",
   "card": 5,
   "is_active": true,
   "channel": 1,
   "bin_number_length": "6",
   "modified_date": "2023-01-16T10:03:28.949597Z",
   "created_date": "2023-01-16T10:03:28.949570Z"
}

```

**Response / 400**

```json

{
   "non_field_errors": [
       "The fields bin_number, channel must make a unique set."
   ]
}

```

**Response / 406**

```json

{
   "non_field_errors": "Channel: <channel_name> <card_name> channel incompatible.",
   "error_code": "bin_number_100_3"
}

```

### `DELETE` BIN​

Path: `/api/v1/bin_numbers/{id}/`

Deletes BIN numbers with the provided ID. Returns status `204` in response.

### `PATCH` Create BIN​

Path: `/api/v1/bin_numbers/{id}/`

Updates the bin\_number information with the provided ID.

```json
{
    "bin_number": "123454",
    "card": 5,
    "is_active": true,
    "channel": 1
}
```

**Response**

```json
{
    "pk": 724,
    "bin_number": "123454",
    "card": 5,
    "is_active": true,
    "bin_number_length": "6",
    "channel": 1,
    "modified_date": "2023-01-16T10:05:53.338918Z",
    "created_date": "2023-01-16T10:03:28.949570Z"
}
```

## Installment

Used for installments with the cards registered on Omnitron. Covers concepts such as the number of installments and late interest. When we enter the details of a card on the Sales Channels > Payment Management > Card Settings page on the Omnitron panel, the bottom of the opened page displays a table with the title “Term Commission Rates”.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All Installment Instances

Path: `/api/v1/installments/`

Returns all installment instances.

**Filters**

Filters can be applied via `card`, `installment_count`, `interest_rate` and `is_active`. E.g.: `?card=1`

**Response**

```json
{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/installments/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "card": 1,
           "installment_count": 1,
           "label": "In Advance",
           "interest_rate": "0.000000",
           "is_active": true,
           "config": {},
           "translations": null,
           "modified_date": "2017-02-01T14:18:17.787615Z",
           "created_date": "2017-02-01T14:18:17.787596Z"
       }]
}
```

### `GET` Installment Detail​

Path: `/api/v1/installments/{id}/`

Returns installments with the provided ID.

**Response**

```json
{
   "pk": 1,
   "card": 1,
   "installment_count": 1,
   "label": "In Advance",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2017-02-01T14:18:17.787615Z",
   "created_date": "2017-02-01T14:18:17.787596Z"
}
```

### `PUT`-`PATCH` Update Installment

Path: `/api/v1/installments/{id}/`

Updates installments with the provided ID.

```json
{
   "card": 1,
   "installment_count": 1,
   "label": "Spot Price",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null
}
```

**Response**

```json
{
   "pk": 1,
   "card": 1,
   "installment_count": 1,
   "label": "Spot Price",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2023-01-16T13:02:55.275401Z",
   "created_date": "2023-01-16T11:35:18.523510Z"
}
```

**Response / 400**

```json

{
   "label": [
       "This field is required."
   ]
}

```

**Response / 406**

```json

{
   "non_field_errors": "Installment: 1 already exists.",
   "error_code": "installment_100_1"
}

```

### `POST` Create Installment

Creates installment objects.

Path: `/api/v1/installments`

```json

{
   "card": 1,
   "installment_count": 99,
   "label": "99 installment",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null
}

```

**Response / 201**

```json

{
   "pk": 74,
   "card": 1,
   "installment_count": 99,
   "label": "99 installment",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2023-01-16T11:35:18.523546Z",
   "created_date": "2023-01-16T11:35:18.523510Z"
}

```

**Response / 400**

```json

{
   "label": [
       "This field is required."
   ]
}
```

**Response / 406**

```json

{
   "non_field_errors": "Installment: 1 already exists.",
   "error_code": "installment_100_1"
}

```

### `DELETE` Installment

Path: `/api/v1/installments/{id}`

Deletes installments with the provided ID. Returns status `204` in response.

## Bank Account

A BankAccount instance must be created for payments by bank transfer. When we enter the details of a bank on the Sales Channels > Payment Management > Banks menu on the Omnitron panel, the opened page displays a table with the title *Bank Accounts*.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All Bank Accounts

Path: `/api/v1/bank_accounts/`

Lists all registered bank accounts by `sort_order`.

**Filters**

Filtering can be done by ID, bank, IBAN and channel. E.g.: `?channel=1&bank=1`

**Response**

```json

{
   "count": 1,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "bank": 3,
           "slug": "account",
           "holder_name": "Company Name",
           "iban": "tr00000000000",
           "is_active": true,
           "sort_order": 0,
           "description": "Bank",
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       }
   ]
}

```

### `GET` Bank Account Detail

Path: `/api/v1/bank_accounts/{id}/`

Returns bank accounts with the provided ID.

**Response**

```json

{
   "pk": 1,
   "bank": 3,
   "slug": "account",
   "holder_name": "Company Name",
   "iban": "tr00000000000",
   "is_active": true,
   "sort_order": 0,
   "description": "Bank",
   "channel": 1,
   "modified_date": "2023-01-16T13:54:53.704234Z",
   "created_date": "2023-01-16T13:38:30.442930Z"
}
```

### `PUT`-`PATCH` Update Bank Account

Updates an existing bank account object with a given body.

Path: `/api/v1/bank_accounts/{pk}/`

**Body**

```json
{
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder1",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1
}
```

or

```json
{
    "holder_name": "New Holder2"
}
```

**Response / 200**

```json
{
    "pk": 1,
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder1",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1,
    "modified_date": "2023-01-16T13:52:30.812893Z",
    "created_date": "2023-01-16T13:38:30.442930Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set.",
       "The fields iban, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Channel: <channel_name> Bank <bank_name> channel incompatible.",
   "error_code": "bank_account_101"
}
-- OR
{
    "non_field_errors": "Channel: Unified of BankAccount: tr00000000000 cannot change.",
    "error_code": "bank_account_102"
}
```

### `POST` Create Bank Account

Creates a new bank account object.

Path: \`/api/v1/bank\_accounts/\`\`

**Body**

```json

{
   "bank": 3,
   "slug": "new_slug",
   "holder_name": "New Holder",
   "iban": "tr00000000000",
   "is_active": true,
   "sort_order": 0,
   "description": "New Bank Account",
   "channel": 1
}

```

**Response / 201**

```json
{
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1,
    "modified_date": "2023-01-16T13:54:53.704234Z",
    "created_date": "2023-01-16T13:38:30.442930Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set.",
       "The fields iban, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Channel: <channel_name> Bank <bank_name> channel incompatible.",
   "error_code": "bank_account_101"
}
```

### `DELETE` Bank Account​

Path: `/api/v1/bank_accounts/{id}/`

Updates the `is_active` field of bank accounts with the provided ID to False. Returns status `204` in response.

## Payment Option

Used to create and list payment options for the sales channels on Omnitron. It can be accessed from Sales Channels > Payment Management > Payment Options on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

### `GET` All Payment Options

Path: `/api/v1/payment_options/`

Returns all payment option objects.

**Filters**

Filtering can be made via the channel, slug, name, `payment_type` and `is_active` fields.\
E.x: ?slug=ödeme-seceneği\&name=ödemeseceneği

Filters are managed via `omnitron.payments.resources.filters.PaymentOptionFilter class`.

**Response**

```json
{
   "count": 2,
   "next": null,
   "previous": null,
   "results": [
       {
           "PK": 2,
           "name": "Credit Card",
           "slug": "credit_card",
           "payment_type": "credit_card",
           "sort_order": 0,
           "is_active": false,
           "config": {},
           "translations": null,
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       },
       {
           "PK": 3,
           "name": "Remintment",
           "slug": "remintment",
           "payment_type": "funds_transfer",
           "sort_order": 2,
           "is_active": true,
           "config": {
               "pos_slug": "ME",
               "rule": {
                   "params": {},
                   "klass": "omnishop.payments.rules.StoredCardRequiredRule"
               }
           },
           "translations": null,
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       }
   ]
}
```

### `GET` Payment Option Detail

Path: `/api/v1/payment_options/{id}/`

Returns the payment options with the provided ID.

**Response**

```json

{
   "PK": 2,
   "name": "Credit Card",
   "slug": "credit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2022-03-28T13:33:51.859441Z",
   "created_date": "2017-02-01T14:46:02.110133Z"
}

```

### `PUT`-`PATCH` Update Payment Option

Path: `/api/v1/payment_options/{id}/`

Updates the payment options with the provided ID.

```json
{
   "PK": 2,
   "name": "Debit Card",
   "slug": "debit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1
}
```

**Response**

```json
{
   "PK": 2,
   "name": "Debit Card",
   "slug": "debit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2023-01-17T06:09:11.965773Z",
   "created_date": "2023-01-17T06:09:11.965748Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
    "non_field_errors": "Channel: test of PaymentOption new-option cannot change.",
    "error_code": "payment_option_101"
}
```

### `POST` Create Payment Option

Used to create new payment option objects. HTTP 400 and HTTP 406 responses may be returned if the request body is not compatible.

Path: `/api/v1/payment_options/`

```json
{
   "name": "New Option",
   "slug": "new-option",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1
}
```

**Response / 201**

```json
{
   "PK": 4,
   "name": "New Option",
   "slug": "new-option",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2023-01-17T06:09:11.965773Z",
   "created_date": "2023-01-17T06:09:11.965748Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```


# Customers

Customers are the people who create orders. A customer object must have an email and channel. All necessary information about customers is kept in customer objects. This includes information about communication permissions accepted by customers for example: email\_allowed, sms\_allowed etc.

## Customer Creation

In order to create a customer record on the Omnitron product, any order from the marketplace must be fetched to Omnitron. When the relevant command runs in marketplace integrations, the order is created in Omnitron. At this stage, if the customer record has not been created before, customer information is created; if the customer record has been created before, the customer information is updated (works with the Upsert logic). Service methods are used in these creation and update processes.

In the integration document, the creation of the order and, accordingly, the creation of the customer will be discussed.

**Potential Responses**

* 201 Created
* 400 Bad Request
* 404 Not Found
* 405 Method Not Allowed
* 406 Not Acceptable

### `GET` Customers

Returns all objects in the Customers table paged.

Path: `/api/v1/customers/`

**Filters**

The available filters are as follows.

```json
"filters": {
   "created_date": {
       "type": "DateFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte",
           "date"
       ]
   },
   "modified_date": {
       "type": "DateFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte",
           "date"
       ]
   },
   "attributes": {
       "type": "JsonMethodFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "channel": {
       "type": "ModelMultipleChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "email": {
       "type": "CharFilter",
       "lookup_types": [
           "exact",
           "startswith"
       ]
   },
   "first_name": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "last_name": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "phone_number": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "is_active": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "channel_code": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "erp_code": {
       "type": "CharFilterWithNull",
       "lookup_types": [
           "exact"
       ]
   },
   "extra_field": {
       "type": "JsonMethodFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "email_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "sms_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "call_allowed": {
       "type": "BooleanFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "date_joined": {
       "type": "IsoDateTimeFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "gender": {
       "type": "ChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "user_type": {
       "type": "ChoiceFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "date_of_birth": {
       "type": "DateFilter",
       "lookup_types": [
           "exact"
       ]
   },
   "id": {
       "type": "NumberFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte"
       ]
   },
   "pk": {
       "type": "NumberFilter",
       "lookup_types": [
           "exact",
           "gt",
           "gte",
           "lt",
           "lte"
       ]
   },
   "mapping": {
       "type": "RelatedFilter",
       "lookup_types": "See available filters for Integration Mappings"
   }
}
```

**Request**

```python
import requests
url = "{omnitron}/api/v1/customers/"
payload={}
headers = {
...
}
response = requests.request("GET", url, headers=headers, data=payload)
```

**Response**

```json
{
    "count": 2,
    "next": "http://{customer_omnitron_url}/api/v1/customers/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 1103,
            "channel": 1,
            "email": "test@test.com",
            "first_name": "TEST",
            "last_name": "denemeler",
            "phone_number": null,
            "is_active": true,
            "channel_code": "7",
            "erp_code": "760906",
            "extra_field": {},
            "modified_date": "2022-12-08T10:49:45.794533Z",
            "created_date": "2017-02-02T09:40:28.855012Z",
            "date_joined": "2017-01-30T08:21:20.657225Z",
            "email_allowed": false,
            "sms_allowed": true,
            "call_allowed": true,
            "gender": null,
            "attributes": {},
            "user_type": null,
            "date_of_birth": null,
            "attributes_kwargs": {},
            "localized_attributes": {},
            "localized_attributes_kwargs": {}
        },
        {
            "pk": 1134,
            "channel": 1,
            "email": "test@test.com",
            "first_name": "",
            "last_name": "",
            "phone_number": null,
            "is_active": false,
            "channel_code": "Shop",
            "erp_code": null,
            "extra_field": {},
            "modified_date": "2023-01-17T09:01:27.544053Z",
            "created_date": "2023-01-17T09:01:27.544026Z",
            "date_joined": null,
            "email_allowed": false,
            "sms_allowed": false,
            "call_allowed": false,
            "gender": null,
            "attributes":  {
                "logged_ip": "127.0.0.1"
            },
            "user_type": null,
            "date_of_birth": null,
            "attributes_kwargs": {},
            "localized_attributes": {},
            "localized_attributes_kwargs": {}
            "user_type": "registered"
        },
    ]
}
```

### `POST` Create a Customer

Records new objects in the Customer table. The CustomerSerializer class defined at `omnitron.customers.resources.serializers` is used to validate the data.

Path: `/api/v1/customers/`

**Body**

```json
{
   "email": "test@test.com",
   "channel": 1,
   "channel_code": "1231",
   "gender": "male",
   "user_type": "registered",
   "is_active": false,
   "erp_code": "er_code",
   "email_allowed": true,
   "sms_allowed": true,
   "call_allowed": true,
   "phone_number": "05555555555",
   "attributes": {},
   "extra_field": {},
   "date_of_birth": "2001-01-01"
}

```

**Response**

```json
{
    "pk": 1117,
    "channel": 1,
    "email": "test@test.com",
    "first_name": "",
    "last_name": "",
    "phone_number": "05555555555",
    "is_active": false,
    "channel_code": "1231",
    "erp_code": "er_code",
    "extra_field": {},
    "modified_date": "2021-05-26T13:53:58.585932Z",
    "created_date": "2021-05-26T13:53:58.585910Z",
    "date_joined": null,
    "email_allowed": true,
    "sms_allowed": true,
    "call_allowed": true,
    "gender": "male",
    "attributes": {},
    "user_type": "registered",
    "date_of_birth": "2001-01-01",
    "attributes_kwargs": {},
    "localized_attributes": {},
    "localized_attributes_kwargs": {}
}
```

**Response HTTP 400**

```json
{
    "non_field_errors": [
        "The fields channel, channel_code must make a unique set."
    ]
}

-- OR

{
    "email": [
        "This field is required."
    ],
    "channel": [
        "This field is required."
    ],
    "channel_code": [
        "This field is required."
    ]
}

-- OR

{
    "email": [
        "Enter a valid email address."
    ]
}

```

### `GET` Customer Detail

Returns the object specified with the primary key in the Customers table by serializing it with the CustomerSerializer class defined at `omnitron.customers.resources.serializers`.

Path: `/api/v1/customers/{pk}/`

**Request**

```json
url = "{customer_omnitron_url}/api/v1/customers/1135/"
payload={}
headers = {
 'Authorization':...'
}

response = requests.request("GET", url, headers=headers, data=payload)
```

**Successful Response**

```json
{
    "pk": 1117,
    "channel": 1,
    "email": "test@test.com",
    "first_name": "",
    "last_name": "",
    "phone_number": "05555555555",
    "is_active": false,
    "channel_code": "1231",
    "erp_code": "er_code",
    "extra_field": {},
    "modified_date": "2021-05-26T13:53:58.585932Z",
    "created_date": "2021-05-26T13:53:58.585910Z",
    "date_joined": null,
    "email_allowed": true,
    "sms_allowed": true,
    "call_allowed": true,
    "gender": "male",
    "attributes": {},
    "user_type": "registered",
    "date_of_birth": "2001-01-01",
    "attributes_kwargs": {},
    "localized_attributes": {},
    "localized_attributes_kwargs": {}

}

```

**Failed Response**

```json
{
    "detail": "Not found."
}
```

### `PATCH` Update Customer

Updates the object of the relevant primary key in the Customer table with the provided parameters.

Path: `/api/v1/customers/{pk}/`

```json
{
   "is_active": true,
   "email_allowed": false,
   "sms_allowed": false,
   "user_type": "registered"
}
```

**Response**

```json
{
    "pk": 1117,
    "channel": 1,
    "email": "test@test.com",
    "first_name": "",
    "last_name": "",
    "phone_number": "05555555555",
    "is_active": true,
    "channel_code": "1231",
    "erp_code": "er_code",
    "extra_field": {},
    "modified_date": "2021-05-26T14:24:11.776744Z",
    "created_date": "2021-05-26T13:53:58.585910Z",
    "date_joined": null,
    "email_allowed": false,
    "sms_allowed": false,
    "call_allowed": true,
    "gender": "female",
    "attributes": {},
    "user_type": "registered",
    "date_of_birth": "2001-01-01",
    "attributes_kwargs": {},
    "localized_attributes": {},
    "localized_attributes_kwargs": {}
}
```

```
HTTP 406  
```

```json
{
    "non_field_errors": "channel:channel_name These field cannot be updated",
    "error_code": "customer_100_3"
} 
```

### `PUT` Update Customer

Allows to change the information of the relevant primary key in the Customer table. Mandatory parameters must be sent.

Path: `/api/v1/customers/{pk}/`

```json
{
    "email": "test2@test.com",
    "channel": 1,
    "channel_code": "1231",
    "is_active": true,
    "email_allowed": false,
    "sms_allowed": false,
    "user_type": "registered",
    "extra_field": {}
}
```

**Successful Response**

```json
{
    "pk": 1117,
    "channel": 1,
    "email": "test2@test.com",
    "first_name": "",
    "last_name": "",
    "phone_number": "05555555555",
    "is_active": true,
    "channel_code": "1231",
    "erp_code": "er_code",
    "extra_field": {},
    "modified_date": "2021-05-26T14:26:52.809180Z",
    "created_date": "2021-05-26T13:53:58.585910Z",
    "date_joined": null,
    "email_allowed": false,
    "sms_allowed": false,
    "call_allowed": true,
    "gender": "female",
    "attributes": {},
    "user_type": "registered",
    "date_of_birth": "2001-01-01",
    "attributes_kwargs": {},
    "localized_attributes": {},
    "localized_attributes_kwargs": {}
}
```

**Failed Response**

If we remove the email data from the body example, the following response will be returned.

```
HTTP 400  
```

```json
{
    "extra_field": [
        "This field is required."
    ],
    "channel": [
        "This field is required."
    ],
    "channel_code": [
        "This field is required."
    ]
}
```

**Note:** When we change the channel information and send a PUT or PATCH request in the body example, the following response will be returned.

```
HTTP 406  
```

```json
{
    "non_field_errors": "channel:channel_name These field cannot be updated",
    "error_code": "customer_100_3"
} 
```


# Order


# Getting Started

## Picking Orders from Channels

In Omnitron, channel-related operations are carried out in the channels module, and integrations related to channels are done in the integration module. Under the **Omnitron > Channels > Integration** folder, there is a cron task for each channel that runs regularly in its own module, takes orders from channels and reflects them to Omnitron.

The operating structure of this cron task is not the same for every channel. The old cron task obtains the IDs of all active channels in the specified channel type, receives orders by querying the channel for orders with the “orders waiting for order status” filter for each channel through the service of the relevant channel, and creates orders in Omnitron with each subsequent order information.

Implemented a command model for integration in new cron tasks An integration object is created from the CommandIntegration class and the action required to pick orders is called by triggering the do\_action method of this integration object.

### First Method​ <a href="#first-method" id="first-method"></a>

There are certain methods allowed for each channel in the channel service. These are defined in the dictionary object `channel_allowed_methods` in the service class. In order for the orders to be picked from the channel, the `get_class method` must be available for calling in the relevant channel. After this control is provided, the Integration object that will enable the Omnitron to communicate with the channel is created, the login method of this object is called, and a connection is established by logging in the channel. If the connection with the channel cannot be established, the `IntegrationUnauthorizedException` error is thrown. When the connection is established, the `get_class` method of the Integration object is called and a dynamic query is created with the filters provided as parameters for each action defined in the actions list and the Serializer class related to the action, and a `GET` query is made to the channel. In case of a successful response to the query, the transaction defined for the action is performed by calling the `request_response` method. The creation of orders received from channels is also done with the `create_order method` in the Integration class.

**Integration​**

Path:`omnitron.channels.integrations.channel_name.integration.Integration`

Allows the Omnitron to communicate with channels. Each channel has its own Integration class.

* **login():** Logs into the channel using the configuration data of the Integration class and updates the auth\_token parameter of the channel object with the one from the new session.
* **response\_process(response, channel\_id, obj, integration\_obj, serializer, action\_name):** Defines and performs what will be done when a successful request is made for a certain method type and a certain action name with the data received following a successful request to the channel. `GET, POST, PATCH, PUT` and `DELETE` methods are defined. When another method is used, an IntegrationNotDefineResponseProcess error is thrown. If the method type is `GET` and `action_name` is “orders,” it calls the `create_order` method for each order data in the query result.
* **create\_order(data):** Ensures the control of the customer, shipping address, billing address, `order_item`, transaction, and discount item data related to the order. Updates the related objects in the Omnitron; otherwise, it creates a new object. If there are separate shipping charges or discounts, it allocates them to each order item using the `OrderService` and `OrderItemService` services and updates the total pricing. If there is a product with a different `data_source`, it performs the same order creation transactions on the vendor side using `VendorOrderService`. Sends the updated order information to the relevant channel. Sends the order information to the cargo company. Returns the created order.
* **create\_orderitem(order\_pk, data):** Gets the product, stock, extra stock and order item image information related to the order item. After verifying the data with `OrderItemSerializer`, it updates the order item with the given data `usingOrderItemService`; if not applicable, it creates a new order item object with `order_pk`. If there is no integration action object/record that keeps the information about the transaction related to this order item, it creates one or updates any existing ones using `IntegrationActionService`. `create_transaction`(order, data): Gets the `POS` and main `POS` information related to the order transaction, and updates it if there is a transaction record that matches the provided data by using `TransactionService`; otherwise, it creates a new one. Using `IntegrationActionService`, it creates an integration action object/record for keeping transaction-related information.

**ReadOrderSerializer​**

Path: `omnitron.channels.integrations.channel_name.serializers.ReadOrderSerializer`

* **get\_endpoint():** In the request created to query the channel, the endpoint subject to request is obtained with this method.

**ChannelService​**

Path: `omnitron.channels.service.ChannelService`

The service for channel-related operations. Operations such as creating and updating channels, sending information from Omnitron to the channel or fetching up-to-date information from the channel to Omnitron are performed in this service. The `get_class` method of this service is used when fetching orders from channels to Omnitron.

* **get\_class(channel, class\_names, timeout, remote\_id, filter\_params):** It enables Omnitron to query the classes specified in the class\_names list from the channel provided as a parameter by using the Integration class of the channel. The details of the query made to the classes and the operations to be performed following the query take place in the Integration class.

### Second Method

As in the first method, there is a cron task that runs at regular intervals for fetching order-related information from the channels. Although the method defined for fetching orders is implemented differently in each channel, the get\_order method is generally called for each channel of that channel type in this cron task. In this method, parameters such as filtering are defined on how to fetch orders from that channel and the `get_orders` method is called with these additional parameters over the integration object. The action of fetching orders from the relevant channel is performed in the channel’s integration class.

Fetching of orders may be customized based on the channel and the relevant method, such as:

* Fetching orders between the desired start and end date upon the providing of date parameters such as `start_date, end_date` and `created_before`
* Fetching specific orders using `order_ids` created in the channel with `order_numbers_to_fetch` fetching orders created after this order by providing an `order_id`
* Fetching all orders regardless of order status with the `fetch_all_orders` parameter.

**CommandIntegration**

Path: `omnitron.channels.integrations.channel_name.integration.CommandIntegration`

Similar to the Integration channel, it allows the Omnitron to communicate with channels. It is inherited from the BasicIntegration and BaseIntegration classes. Since the Integration class is inherited from the BaseIntegration class, it covers what is described in the Integration section. Apart from the Integration class, it also inherits the BasicIntegration class, so various actions can be easily implemented by implementing the Command design pattern with the do\_action method. This section will be detailed in the Integration document.

* **do\_action(key, objects=None, force=False, kwargs):** With the key parameter, it obtains the serializer class for which action to take. The parameters or verification methods that each channel wants to receive upon order requests may differ, which is why each Integration class can use its own Serializer classes. The Serializer class to be used for the get\_orders action is defined in the serializer\_class dictionary of each channel’s Integration class. After receiving the Serializer class, it calls the `get_objects` method and then calls the `qs__action_name` method for the action provided in the key. This method returns a Django ORM Query object created for how to fetch orders. An object is derived from the Serializer class to obtain the objects fetched upon query as parameters, and by calling the run method of this object, the processes of sending a request to the channel and the creation of orders by Omnitron according to the result returned upon the request are performed in the action class.

**Serializer/Command**

Path: `omnitron.channels.integrations.channel_name.commands.GetOrders`

The process of fetching and verifying the features of the order takes place in the Serializer class. In addition, as a result of the implementation of the Command design pattern, sending a request to the channel described in the first method and creating records such as order and order item, transaction etc. take place in this class. Since the "create" operations are performed as in the first method, the details will not be repeated. **run():** The method that distinguishes this class from the standard Serializer classes and implements the command design pattern. Similar to the operating principle of the `request_process` and `response_process` methods mentioned in the first method, it creates the request to be sent to the channel with the send method, sends it and upon a successful response, it completes the action by providing the parameter the method defined for the relevant action.

### Service

**OrderService**

Path: `omnitron.orders.service.OrderService`

It is the service where operations such as creating, updating, deleting the order, as well as reflecting the discount items on the products in the order and canceling the order are carried out.

* **create\_order(number, channel, kwargs):** Checks if there is an order object with the provided number and throws an `OrderDuplicatedFieldException` if applicable; otherwise, it creates a new order object with the number in the provided channel.
* **update\_order(order, audit\_context, kwargs):** Updates the placed order object and order items with the information in kwargs.
* **change\_billing\_address(order, address):** Changes the billing address of the order by using the relevant strategy.
* **change\_shipping\_address(order, address):** Changes the shipping address of the order using the relevant strategy.
* **change\_order\_status(order, status):** Changes order and item status.
* **set\_distribute\_interest\_amount(order):** If there are discounts to be applied on the order items, it provides how these will be applied and recalculation of the shipping fee, applies the discount rates on the order items and updates the shipping fee of the order. If there is another discount in the basket, the discount is distributed among the products. If the discount amount is higher than the value of the product, it is distributed to other products.
* **cancel\_order(order, reasons, audit\_context, is\_all, cancel\_items, forced\_refund\_amount, is\_cargo\_refund, refund\_invoice\_number, next\_status, ibans, holder\_names, diagnose):** Performs the cancellation of the order and the operations related to the order item affected by the cancellation, discount rates update, refund transactions, cancellation strategy etc.
* \*\*update\_cancellation\_plan(cancellation\_plan, status, audit\_context, **kwargs):** Updates the provided cancellation plan object with the data in kwargs.
* **order\_status\_update(order):** Allows the order status to be updated according to the lowest status among the active order items.
* **reject\_order\_cancel(order, audit\_context):** Updates the statuses of order and items to be canceled to their previous status, and the cancellation status to "rejected." Updates the status of the cancellation request and plan of the order and items. `approved_order_cancel`(order, invoice\_number, audit\_context): Performs the operations related to the cancellation and refund of the orders with approved status and received payments.
* \*\*get\_payment\_history(order, **kwargs):** Fetches detailed transaction information about the order from the relevant pos gateway.
* **get\_transaction\_amount(order):** Using the `get_payment_history` method, the total amount is calculated by fetching the order-related transactions. `update_cancel_status`(order, order\_items, cancel\_status, audit\_context, kwargs): If there are order and item transactions such as cancellation plan and manual return according to the request, the controls are made and a transaction is created. Status updates are made for the order, items, cancellation plan, and cancellation request.
* **progress\_cancel\_status(payment\_type, update\_cancel\_status):** `payment_type` orders with payment methods provided as parameters are fetched, and the status of the cancellation plan objects of the order is updated to the `update_cancel_status` provided as a parameter.
* **confirm\_pay\_on\_delivery(order):** It is checked whether the payment method of the order is `pay on delivery`, the order, the order items and, if any, the status of the vendor order are updated from `confirmation waiting` to `approved`.
* **accept\_in\_store(order):** Confirms that the order can be picked up from the store.
* **deliver\_in\_store(order):** Confirms that the order has been picked up from the store.
* **mark\_as\_not\_sent(order):** Updates and stores the `is_sent` information that the order has been approved, but has not been sent as "False."
* **bulk\_tracking\_number\_update(uploaded\_file):** Provides bulk tracking number update for all orders in the file provided as a parameter.

**OrderItemService​**

Path: `omnitron.orders.service.OrderItemService`

Where the transactions related to the products in the order are made.

* **create\_order\_item(order, product, image, kwargs):** An order item is created for the order object and product provided as a parameter. It updates the stock information of the order item using the product stock service.
* **update\_order\_item(order\_item, image, shipping\_update, force, audit\_context, kwargs):** Updates the order item provided as a parameter with the information sent with kwargs and the image parameter.
* **update\_order\_item\_send\_stock(order\_item):** Updates the stock information of the product for the placed order item.
* **send\_shipping\_info(order\_items):** If there are vendor order items for the ordered items, the vendor sends the shipping information of the order item to the relevant data source, and updates the order item according to this information.

### Model

Structure that represents the tables in the database.

**Order**

Path: `omnitron.orders.models.Order`

The Order Model is inherited from the `OmnitronBaseOrder` model. The `OmnitronBaseOrder` model is inherited from the `omnicore.orders.models.BaseOrder` model.

`OmnitronBaseOrder`

<table data-header-hidden><thead><tr><th width="246.8125"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td><strong>Description</strong></td></tr><tr><td>Number</td><td>CharField, every order has an order number.</td></tr><tr><td>Status</td><td>EnumField; stores the status of the order item. It can take values from the omnicore.orders.enums.OrderStatus model.</td></tr><tr><td>date_placed</td><td>DateTimeField, date placed</td></tr><tr><td>extra_field</td><td>JSONField</td></tr><tr><td>delivery_type</td><td>EnumField, ShippingOptionDeliveryType</td></tr><tr><td>checkout_provider_id</td><td>IntegerField, provider id</td></tr><tr><td>e_archive_url</td><td>URLField, E-Archive address</td></tr><tr><td>remote_addr</td><td>GenericIPAddressField</td></tr><tr><td>Shipping_address</td><td>ForeignKey, ID of the shipping address</td></tr><tr><td>Billing_address</td><td>ForeignKey, ID of the billing address</td></tr><tr><td>Currency</td><td>EnumField, stores the currency of the order item fee. Gets the values in the omnicore.catalogs.enums.CurrencyType class. These may be tr, eu, usd, egp, gbp, mad, pln, sar, ron, uah, czk, huf, rub, bgn and iqd. This is TR by default.</td></tr><tr><td>Amount</td><td>DecimalField, order amount</td></tr><tr><td>Discount_amount</td><td>DecimalField, discount amount</td></tr><tr><td>Shipping_amount</td><td>DecimalField, shipping amount</td></tr><tr><td>Shipping_tax_rate</td><td>DecimalField, shipping tax rate</td></tr><tr><td>Refund_amount</td><td>DecimalField, refund amount</td></tr><tr><td>Discount_refund_amount</td><td>DecimalField, discount refund amount</td></tr><tr><td>Shipping_refund_amount</td><td>DecimalField, shipping refund amount</td></tr><tr><td>Invoice_number</td><td>CharField, invoice number</td></tr><tr><td>Invoice_date</td><td>DateTimeField, invoice date</td></tr><tr><td>Tracking_number</td><td>CharField, tracking number</td></tr><tr><td>Shipping_company</td><td>EnumField, stores the information of the shipping company. May get the information defined in the omnicore.orders.enums. ShippingCompany class.</td></tr><tr><td>Channel</td><td>ForeignKey, ID of the order channel</td></tr><tr><td>Customer</td><td>ForeignKey, ID of the customer placing the order</td></tr><tr><td>Payment_option</td><td>ForeignKey, ID of the payment option</td></tr><tr><td>Payment_option_slug</td><td>SlugField, slug code of the payment option</td></tr><tr><td>Bin_number</td><td>CharField, a field regarding the bank information related to the payment.</td></tr><tr><td>Installment</td><td>ForeignKey, related to installments</td></tr><tr><td>Installment_count</td><td>PositiveIntegerField, installment count</td></tr><tr><td>Installment_interest_amount</td><td>DecimalField, installment interest amount</td></tr><tr><td>Cargo_company</td><td>ForeignKey, ID of the cargo company</td></tr><tr><td>Is_send</td><td>BooleanField, stores the information whether the order has been sent.</td></tr><tr><td>Cancellation_info</td><td>JSONField, stores cancellation information.</td></tr><tr><td>Cancel_status</td><td><p>EnumField, stores cancel status. May get the values in the CancelStatus model. These are respectively:</p><ul><li><strong>Waiting</strong>: waiting</li><li><strong>Confirmation_waiting</strong>: Confirmation waiting, used to check the availability of the order for situations such as trade-in.</li><li><strong>Confirmed</strong>: Confirmed, used to check the availability of the order for situations such as trade-in.</li><li><strong>Approved</strong>: Approved, states that the order is ready to be sent out.</li><li><strong>Rejected</strong>: Rejected, used in cases where the order is rejected due to reasons such as not being suitable for trade-in or failure to receive payment.</li><li><strong>Waiting_for_payment</strong>: waiting for payment</li><li><strong>Manuel_refund_need</strong>: manual refund need</li><li><strong>Completed</strong>: completed</li></ul></td></tr><tr><td>Shipping_interest_amount</td><td>DecimalField, shipping interest amount</td></tr><tr><td>External_status</td><td>ForeignKey, stores different displays of order statuses in applications such as OMS or on the market side.</td></tr><tr><td>ClientType</td><td>EnumField, stores the default client type. The client can be Android, iOS, In-Store or default.</td></tr><tr><td>Carrier_shipping_code</td><td>CharField, carrier shipping code</td></tr><tr><td>Segment</td><td>CharField</td></tr><tr><td>has_gift_box</td><td>NullBooleanField, has gift box</td></tr><tr><td>gift_bpx_note</td><td>CharField, gift box note</td></tr><tr><td>language_code</td><td>CharField, language code</td></tr><tr><td>notes</td><td>CharField, instructions</td></tr><tr><td>delivery_range</td><td>DateTimeRangeField</td></tr><tr><td>shipping_option_slug</td><td>SlugField, shipping option slug</td></tr></tbody></table>

**OrderItem**

Path: `omnitron.orders.models.OrderItem`

Inherited from the `OmnitronBaseOrderItem` model. And this model is inherited from the `omnicore.orders.models.BaseOrderItem` model.

| **Name**                      | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Order                         | ForeignKey, order ID of the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Product                       | ForeignKey, product ID of the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Status                        | <p>EnumField; stores the status of the order item. It can take values from the omnicore.orders.enums.OrderStatus model. These are:</p><ul><li><strong>Cancellation\_waiting</strong>: cancellation waiting</li><li><strong>Cancelled</strong>: canceled</li><li><strong>Waiting</strong>: waiting</li><li><strong>Payment\_waiting</strong>: payment waiting</li><li><strong>Confirmation\_waiting</strong>: confirmation waiting</li><li><strong>Approved</strong>: approved</li><li><strong>Preparing</strong>: preparing</li><li><strong>Shipped</strong>: shipped</li><li><strong>Shipped\_and\_informed</strong>: shipped and informed</li><li><strong>Ready\_for\_pickup</strong>: ready for pickup</li><li><strong>Attempted\_delivery</strong>: attempted delivery</li><li><strong>Review\_started</strong>: review started</li><li><strong>Review\_waiting</strong>: review waiting</li><li><strong>Delivered</strong>: delivered</li><li><strong>Refunded</strong>: refunded</li></ul> |
| attributes                    | JsonField, product features                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| attributes\_kwargs            | JsonField, key of product features                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| localized\_attributes         | JsonField, localized product features                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| localized\_attributes\_kwargs | JsonField, key of localized product features                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| extra\_field                  | JsonField                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| e\_archive\_url               | URLField, E-Archive address                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Price\_currency               | EnumField, stores the currency of the order item fee. Gets the values in the omnicore.catalogs.enums.CurrencyType class. These may be tr, eu, usd, egp, gbp, mad, pln, sar, ron, uah, czk, huf, rub, bgn and iqd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Price                         | DecimalField, price of the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Tax\_rate                     | DecimalField, tax rate                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Invoice\_number               | CharField, invoice number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Invoice\_date                 | DateTimeField, invoice date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Tracking\_number              | CharField, tracking number                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Shipping\_company             | EnumField, stores the information of the shipping company. May get the information defined in the omnicore.orders.enums.ShippingCompany class.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Retail\_price                 | DecimalField, retail price                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Image                         | ImageField, order item image                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Parent                        | ForeingKey(’self’), ID of an inherited order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Estimated\_delivery\_date     | DateField, estimated delivery date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Price\_list                   | ForeignKey, ID of the price list for the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Stock\_list                   | ForeignKey, ID of the stock list for the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Discount\_amount              | DecimalField, discount amount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| External\_status              | ForeignKey, stores the status of the order item on platforms such as OMS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Shipped\_date                 | DateTimeField, shipped date of the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Delivered\_date               | DateTimeField, delivered date of the order item                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Carrier\_shipping\_code       | CharField, carrier shipping code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Transactions                  | ManyToManyField, stores payment transactions related to the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Funds\_transactions           | ManyToManyField, stores fund transactions related to the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Payondelivery\_transactions   | ManyToManyField, stores pay-on-delivery transactions related to the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Loyalty\_transactions         | ManyToManyField, stores loyalty transactions related to the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Cashregister\_Transactions    | ManyToManyField, stores cash register transactions related to the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Reconciliation                | ForeignKey, ID of the reconciliation for the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Cancellation\_reconciliation  | ForeignKey, ID of the cancellation reconciliation for the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Cancel\_status                | <p>EnumField, stores cancel status. May get the values in the CancelStatus model. These are respectively:</p><ul><li><strong>Waiting</strong>: Waiting</li><li><strong>Confirmation\_waiting</strong>: confirmation waiting, used to check the availability of the order for situations such as trade-in.</li><li><strong>Confirmed</strong>: Confirmed, used to check the availability of the order for situations such as trade-in.</li><li><strong>Approved</strong>: Approved, states that the order is ready to be sent out.</li><li><strong>Rejected</strong>: Rejected, used in cases where the order is rejected due to reasons such as not being suitable for trade-in or failure to receive payment.</li><li><strong>Waiting\_for\_payment</strong>: Waiting for payment</li><li><strong>Manuel\_refund\_need</strong>: Manual refund need</li><li><strong>Completed</strong>: Completed</li></ul>                                                                                     |
| Forced\_refund                | BooleanField, stores whether there is a forced refund.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Installment\_interest\_amount | DecimalField, installment interest amount for the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Discount\_amount              | DecimalField, discount amount for the order item.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| datasource                    | ForeignKey, ID of the channels.DataSource model.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

### ViewSet

The part where the endpoints are connected to each other and the controls and processing are made for the transactions to be performed by the service.

**OrderViewSet**

`omnitron.orders.resources.views.OrderViewSet`

Path: `/api/v1/orders/`

`GET, POST, PATCH, PUT` and `DELETE` requests are allowed. Like other viewsets, create, update and destroy are performed through the service. Details of the aforementioned **Service** are available.

Custom endpoints:

* `POST` change\_billing\_address
* `POST` change\_shipping\_address
* `PATCH` change\_order\_status
* `POST` create\_mapping
* `POST` cancel
* `POST` cancellation\_reject\_order
* `POST` cancellation\_approved\_order
* `POST` update\_cance\_status
* `POST` accept\_in\_store
* `POST` deliver\_in\_store
* `GET` update\_order\_status
* `GET` get\_remote\_id
* `POST` mark\_as\_not\_sent
* `POST` split\_packages
* `POST` bulk\_tracking\_number\_update
* `GET` bulk\_tracking\_number\_update\_status

The structure of these endpoints will be shown with an example, as they return the serialized order after sending the request and the data in the request to the service and performing the operation in the service, and these operations are detailed in the **Service** section.

## `GET` All Orders

Endpoint that allows all orders to be retrieved in paginated form.

Path: `api/v1/orders/`

**Response**

The link and details of the orders required to reach the next page, the total number of orders, are sent as a response.

```json
{
  "count": 101,
  "next": "{customer_omnitron_url}/api/v1/orders/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 34,
      "number": "7cf135a8056542e",
      "channel": 1,
      "status": "400",
      "date_placed": "2017-02-02T16:04:07.574254Z",
      "customer": 1106,
      "shipping_address": 30,
      "billing_address": 30,
      "currency": "try",
      "amount": "19.62",
      "shipping_amount": "8.50",
      "shipping_tax_rate": null,
      "extra_field": {
        "cargo_line_id": "6d53c809-c55c-49e6-8e88-a70f00ef9d01"
      },
      "payment_option": 2,
      "payment_option_slug": "credit_card",
      "bin_number": "454360",
      "installment": 22,
      "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": 8.5,
      "shipping_interest_amount": "0.00",
      "tracking_number": null,
      "carrier_shipping_code": null,
      "remote_addr": null,
      "fundstransfertransaction_set": [],
      "has_gift_box": false,
      "gift_box_note": null,
      "external_status": null,
      "client_type": "default",
      "language_code": null,
      "notes": null,
      "delivery_range": null,
      "shipping_option_slug": null,
      "segment": null
    }
  ]
}
```

## `GET` Order By Order Number

Following method is used to get information of all related orders including {number} value in any part of the order number.

Path: `/api/v1/orders/?number={number}`

Following method is used to ger information of a single order in which the order number is exactly same as the {number}.

Path: `/api/v1/orders/?number__exact={number}`

**Response**

The detailed information of the order belonging to the order number specified in the request is sent as a response.

**Example Request:** `/api/v1/orders/?number=8610`

```json
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 277,
      "number": "1222078610011628",
      "channel": 1,
      "status": "400",
      "date_placed": "2019-12-27T07:00:21.457087Z",
      "customer": 1867,
      "shipping_address": 1875,
      "billing_address": 1875,
      "currency": "try",
      "amount": "200.00",
      "shipping_amount": "0.00",
      "shipping_tax_rate": null,
      "extra_field": {},
      "payment_option": 6,
      "payment_option_slug": "mobilexpress",
      "bin_number": null,
      "installment": 3,
      "installment_count": 1,
      "installment_interest_amount": "0.00",
      "cargo_company": 1,
      "invoice_number": null,
      "invoice_date": null,
      "e_archive_url": null,
      "refund_amount": "100.00",
      "discount_refund_amount": "0.00",
      "shipping_refund_amount": "0.00",
      "discount_amount": "0.00",
      "is_send": true,
      "net_shipping_amount": 0,
      "shipping_interest_amount": "0.00",
      "tracking_number": null,
      "carrier_shipping_code": null,
      "remote_addr": "213.194.76.106",
      "fundstransfertransaction_set": [],
      "has_gift_box": false,
      "gift_box_note": null,
      "external_status": null,
      "client_type": "default",
      "language_code": "tr-tr",
      "notes": null,
      "delivery_range": null,
      "shipping_option_slug": null,
      "segment": null,
      "modified_date": "2021-09-15T11:07:47.931518Z"
    },
    {
      "pk": 182,
      "number": "1186104634112903",
      "channel": 1,
      "status": "550",
      "date_placed": "2019-11-15T15:41:27.849836Z",
      "customer": 24,
      "shipping_address": 25,
      "billing_address": 25,
      "currency": "try",
      "amount": "107.00",
      "shipping_amount": "7.00",
      "shipping_tax_rate": null,
      "extra_field": {},
      "payment_option": 2,
      "payment_option_slug": "credit_card",
      "bin_number": "555555",
      "installment": 3,
      "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": "19025",
      "carrier_shipping_code": null,
      "remote_addr": "213.194.76.106",
      "fundstransfertransaction_set": [],
      "has_gift_box": false,
      "gift_box_note": null,
      "external_status": null,
      "client_type": "default",
      "language_code": "tr-tr",
      "notes": null,
      "delivery_range": null,
      "shipping_option_slug": null,
      "segment": null,
      "modified_date": "2021-09-10T03:51:41.052320Z"
    }
  ]
}
```

## `POST` Update Cancel Status

Path: `/api/v1/orders/151/update_cancel_status/`

Endpoint that is used to change the cancellation status of the order.

```json
{
   "order": "<order_id>",
   "order_items": [order_item1_id, order_item2_id],
   "cancel_status": "cancel_status"
} 
```

**Response**

According to the data transmitted in the request, the order whose cancel\_status field has been updated and all data including the order items belonging to this order will be sent as a response. Properties are in Python format.

```json
{
  "pk": 111,
  "number": "1535788520612146",
  "channel": " ",
  "status": "400",
  "date_placed": "2020-12-24T09:07:54.639779Z",
  "customer": " ",
  "shipping_address": "{..}",
  "billing_address": "{...}",
  "currency": "try",
  "amount": "336.38",
  "shipping_amount": "8.50",
  "shipping_tax_rate": null,
  "extra_field": {},
  "orderitem_set": [
    {
      "pk": 221,
      "order": 111,
      "product": "{...}",
      "status": "400",
      "price_currency": "try",
      "price": "127.98",
      "tax_rate": "8.00",
      "extra_field": "{...}",
      "price_list": "{...}",
      "stock_list": "{...}",
      "invoice_number": null,
      "invoice_date": null,
      "e_archive_url": null,
      "cancel_status": "manuel_refund_need",
      "status_display": "approved",
      "installment_interest_amount": "0.00",
      "net_amount": "127.98",
      "tracking_number": null,
      "shipping_company": null,
      "discount_amount": "0.00",
      "shipment_code": null,
      "benefitapplicant_set": [],
      "external_status": null,
      "retail_price": "319.96",
      "attributes": {},
      "attributes_kwargs": {},
      "tracking_url": null,
      "image": null,
      "parent": null,
      "data_source": null,
      "estimated_delivery_date": null
    }
  ],
  "discountitem_set": [],
  "transaction_set": [],
  "payment_option": "{...}",
  "payment_option_slug": "credit_card",
  "bin_number": null,
  "installment": "{...}",
  "installment_count": 1,
  "installment_interest_amount": "0.00",
  "cargo_company": "{...}",
  "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",
  "cancellation_info": "{...}",
  "status_display": "approved",
  "tracking_number": null,
  "is_send": true,
  "cancel_status": "manuel_refund_ned",
  "net_shipping_amount": 8.5,
  "remote_addr": "127.0.0.1",
  "language_code": "tr-tr",
  "fundstransfertransaction_set": [],
  "has_gift_box": false,
  "gift_box_note": null,
  "tracking_url": null,
  "external_status": null,
  "payondeliverytransaction_set": [],
  "loyaltytransaction_set": [],
  "bextransaction_set": [],
  "cancellationplan_set": [],
  "cashregistertransaction_set": [],
  "client_type": "default",
  "shipping_interest_amount": "0.00",
  "notes": null,
  "delivery_range": null,
  "shipping_option_slug": "UPS",
  "segment": null
}
```


# Fulfillment

Fulfillment is handled under four items. These are shipping options, shipping company, tracking number and invoice number.

## Shipping Options

**Methods**: `GET`, `POST`, `PATCH`, `PUT`, `DELETE`

Shipping options are stored in the shop database. A request is sent to the shop by proxy via Omnitron. In line with this request, the response from the shop is shown on the frontend via Omnitron.

### `GET` Shipping Options

**Path:** `api/v1/remote/1/shipping_options/`

When a GET request is thrown directly via shipping\_options/, you can get all the shipping options. If you throw a GET request such as shipping\_options/1/, you can get the shipping option with an ID value of 1. (Send a different ID value instead of 1).

### `POST` Create Shipping Option

**Path:** `api/v1/remote/1/shipping_options/`

When a post request is sent to the shipping\_options/ endpoint, like the sample data below, the creation will be completed.

```json
{
"name": "test1",          # Name
"slug": "test12",         # Slug value
"calculator": {},         # Calculator definition used to calculate
"rule": {},               # Rules defined according to the products entered by the customer
"sort_order": 12,         # priority
"description": "Test12", 
}
```

Above, there are two different values besides text and number. One is Calculator, and the other is Rule. These values are explained below.

### `PATCH` Update Shipping Option

**Path:** `api/v1/remote/1/shipping_options/{id}/`

When a patch request is sent to the shipping\_options/{id} endpoint, like the sample data below, the update will be completed. You can update the shipping option with an ID value of 1. (Send a different ID value instead of 1).

```json
{
    "calculator": {
          "name":"Free Calculator",
          "slug":"free-calculator"
          },
    "rule": {
          "name":"Any Rule",
          "slug":"any-rule"
          }
}
```

### `PUT` Update Shipping Option

**Path:** `api/v1/remote/1/shipping_options/{id}/`

When a put request is sent to the shipping\_options/{id} endpoint, like the sample data below, the update of the entire field will be completed. You can update the shipping option with an ID value of 1. (Send a different ID value instead of 1).

```json
{
    "name": "test22",
    "slug": "test22",
    "calculator": {
          "name":"Free Calculator",
          "slug":"free-calculator"
          },
    "rule": {
          "name":"Any Rule",
          "slug":"any-rule"
          },
    "sort_order": 3,
    "description": "Test14",
}
```

Above, there are two different values besides text and number. One is Calculator, and the other is Rule. These values are explained below.

### `DELETE` Shipping Option

**Path:** `api/v1/remote/1/shipping_options/{id}/`

`shipping_options/{id}/` When a delete request is sent to the shipping\_options/{id} endpoint, like the sample data below, the deletion will be completed. You can delete the shipping option with an ID value of 1. (Send a different ID value instead of 1).

## Calculator and Rule

### Calculator

It is used to calculate the price according to the total of the products added to the basket or according to different conditions.

* **FreeCalculator**: The calculator used to process the shipping fee as free of charge. Use;

```json
{
    "name":"Free Calculator",
    "slug":"free-calculator"
}
```

* **FixedPriceCalculator**: Used to process the shipping fee as a fixed price. Fixed\_price refers to the fixed shipping fee.\
  Use;

```json
{
    "fixed_price":"8.50",
    "name":"Fixed Based Calculator",
    "slug":"fixed-based-calculator"
}
```

* **AmountBasedCalculator**: Used to calculate the shipping fee according to the prices of the products in the basket. Fixed\_price refers to the fixed shipping fee. Upper\_limit refers to the upper limit of the products in the basket. Discount\_price refers to the discounted price. If upper\_limit is exceeded, discount\_price is activated.\
  Use;

```json
{
    "name":"Amount Based Calculator",
    "slug":"amount-based-calculator",
    "fixed_price":"9.90",
    "upper_limit":"150.00",
    "discount_price":"0.00"
}
```

* **WeightBasedCalculator**: Used to calculate the shipping fee according to the weight of the products in the basket. List-type weight\_ranges state lower\_limit, upper\_limit and the cargo price within these limits as the price.\
  Use;

```json
{
    "name":"Weight Based Calculator",
    "slug":"weight-based-calculator",
    "weight_ranges":[
        {
           "lower_limit":1,
           "upper_limit":5,
           "price":9.9
        },
        {
           "lower_limit":6,
           "upper_limit":10,
           "price":19.9
        },
        {
           "lower_limit":11,
           "upper_limit":15,
           "price":29.9
        }]
}
```

* **ShippingCostCalculator**: The calculator that provides cost calculation according to the shipping address. It presents the customer with the shipping cost obtained upon filtering according to the slug definition in the ShippingCost model and the address match in the ShippingCost model.\
  Use;

```json
{
    "shipping_cost_slug":"under-3000",
    "name":"Shipping Cost Calculator",
    "slug":"shipping-cost-calculator"
}
```

* **AttributeBasedShippingCostCalculator**: The calculator that combines the address based shipping cost with an amount based fee. The shipping cost is obtained from the ShippingCost model according to shipping\_cost\_slug and the shipping address. For the products in the basket whose attribute\_field value is not attribute\_value, fixed\_price is added if their total is below upper\_limit; otherwise, discount\_price is added. If all products match the attribute, only the shipping cost is applied.\
  Use;

```json
{
    "shipping_cost_slug":"furniture",
    "attribute_field":"shipment_type",
    "attribute_value":"furniture",
    "fixed_price":"8.99",
    "upper_limit":"150.00",
    "discount_price":"0.00",
    "name":"Attribute Based Shipping Cost Calculator",
    "slug":"attribute-based-shipping-cost-calculator"
}
```

* **DiscountBasedCalculator**: The calculator that works according to the determined base calculator and the availability of the products in the basket. Base\_shipping contains the slug value of the base calculator. The relevant parameters are dynamically stored.\
  Use;

```json
{
    "name": "Discount Based Calculator",
    "slug": "discount-based-calculator",
    "fixed_price": "9.90",
    "upper_limit": "150.00",
    "base_shipping": "amount-based-calculator",
    "discount_price": "0.00"
}
```

* **B2CDirectCalculator**: Shipping calculator for B2C Direct. B2C Direct shipping company is inactive.\
  Use;

```json
{
    "name":"B2C Direct Calculator",
    "slug":"b2c-direct-calculator"
}
```

### Rule

The section containing the rules that the relevant shipping option should cover. Can be used in association with each other.

* **AnyRule**: Progress independent of any rule.\
  Use;

```json
{
    "name":"Any Rule",
    "slug":"any-rule"
}
```

* **WeightRule**: Establishes weight rule.\
  max\_weight covers the maximum weight. Weight\_field specifies the attribute name that defines the weight of the products in the basket. If there is none, the default is entered as 0.\
  Use;

```json
{
    "name":"Weight Rule",
    "slug":"weight-rule",
    "max_weight":1,
    "weight_field":"weight"
}
```

* **TotalVolumetricWeightRule**: Establishes total volumetric weight rule for the products in the basket. total\_max\_volumetric\_weight covers the maximum volume. volumetric\_weight\_field specifies the attribute name that defines the volume of the products in the basket. If there is none, the default is entered as 0.\
  Use;

```json
{
    "name":"Total Volumetric Rule",
    "slug":"total-volumetric-weight-rule",
    "total_max_volumetric_weight":1,
    "volumetric_weight_field":"weight"
}
```

* **HeightRule**: Establishes rule based on height.\
  max\_height covers maximum height. Height\_field specifies the attribute name that defines the height of the products in the basket. If there is none, the default is entered as 0.\
  Use;

```json
{
    "name":"Height Rule",
    "slug":"height-rule",
    "max_height":1,
    "height_field":"height"
}
```

* **CityRule**: Establishes city rule according to the entered address.\
  Use; if the Exclude field is true, it includes excluding the entered cities, if false, it only includes the entered cities. Cities is where the city IDs must go\
  Use;

```json
{
    "name":"City Rule",
    "slug":"city-rule",
    "cities":[1,2,3,4],
    "exclude":true
}
```

* **CountryRule**: Establishes country rule according to the entered address.\
  Use; if the Exclude field is true, it includes excluding the entered countries, if false, it only includes the entered countries. Countries is where the country IDs must go\
  Use;

```json
{
    "name":"Country Rule",
    "slug":"country-rule",
    "countries":[1,2,3,4],
    "exclude":true
}
```

* **TownshipRule**: Establishes township rule according to the entered address.\
  Use; if the Exclude field is true, it includes excluding the entered townships, if false, it only includes the entered townships. Townships is where the township IDs must go\
  Use;

```json
{
    "name":"Township Rule",
    "slug":"township-rule",
    "townships":[1,2,3,4],
    "exclude":true
}
```

* **DistrictRule**: Establishes district rule according to the entered address.\
  Use; if the Exclude field is true, it includes excluding the entered districts, if false, it only includes the entered districts. Districts is where the district IDs should go\
  Use;

```json
{
    "name":"District Rule",
    "slug":"district-rule",
    "districts":[1,2,3,4],
    "exclude":true
}
```

* **TimeRule**: The rule that covers the order interval determined with start\_time and end\_time.\
  Use;

```json
{
    "name":"Time Rule",
    "slug":"time-rule",
    "start_time":"15:00",
    "end_time":"18:00"
}
```

* **DayOfWeekRule**: Establishes day of week rule.\
  Use;

```json
{
    "name":"Day Of Week Rule",
    "slug":"day-of-week-rule",
    "days":["Wednesday","Thursday","Friday"]
}
```

* **BasketAmountRule**: Establishes the basket amount rule.\
  Use;

```json
{
    "name":"Basket Amount Rule",
    "slug":"basket-amount-rule",
    "max_total_amount":10
}
```

* **TotalProductAmountRule**: Establishes the total product amount rule.\
  Use;

```json
{
    "name":"Total Product Amount Rule",
    "slug":"total-product-amount-rule",
    "max_total_amount":10
}
```

* **ProductAttributeRule**: Establishes the product attribute rule.\
  Use;

```json
{
    "name":"Product Attribute Rule",
    "slug":"product-attribute-rule",
    "attribute_field":"test_attr",
    "attribute_value":"free shipping"
}
```

* **RetailStoreRule**: Establishes the retail store rule.\
  Use;

```json
{
    "name":"Retail Store Rule",
    "slug":"retail-store-rule"
}
```

* **NotRule**, **AndRule** and **OrRule**: Rule configuration is a flexible structure in which an unlimited number of nested sub-rules can be written, producing results by applying "and", "or" and "not" logic operations on custom rule sets. The "or" and "and" rules must have a "children" field, while the "not" rule must have a "child" field. Each of the custom rules has different fields.\
  Use;

```json
{
  "children": [
    {...(rule1)},
    {
      "children": [
        {
          "child": {...(rule2)},
          "name": "Not Rule",
          "slug": "not-rule"
        },
        {
          "child": {...(rule3)},
          "name": "Not Rule",
          "slug": "not-rule"
        }
      ],
      "name": "And Rule",
      "slug": "and-rule"
    }
  ],
  "name": "Or Rule",
  "slug": "or-rule"
}
```

* **RetailStoreStockRule**: Establishes the retail store stock rule.\
  Use;

```json
{
    "name":"Retail Store Stock Rule",
    "slug":"retail-store-stock-rule"
}
```

* **RegisteredUserRule**: Establishes the registered user rule.\
  Use;

```json
{
    "name":"Registered User Rule",
    "slug":"registered-user-rule"
}
```

## Shipping Company

**Path**: `api/v1/cargos/`

**Methods**: `GET`, `POST`, `PATCH`, `PUT`, `DELETE`

Shipping companies are stored on Omnitron. This is the structure that enables the integrated shipping companies to be selected by means of enums and used in relevant places.

### `GET` Shipping Company

**Path:** `api/v1/cargos/`

When a GET request is thrown directly via cargos/, you can get all the shipping companies. If you throw a GET request such as cargos/1/, you can get the shipping company with an ID value of 1. (Send a different ID value instead of 1).

### `POST` Create Shipping Company

**Path:** `api/v1/cargos/`

When a post request is sent to the cargos/ endpoint, like the sample data below, the creation will be completed.

```json
{
  "name": "test",               # Name
  "erp_code": "erp_test",       # erp code value
  "shipping_company": "ups"     # courier company enum value
}
```

**Shipping company enum values** are stated below.

### `PATCH` Update Shipping Company

**Path:** `api/v1/cargos/{id}/`

When a patch request is sent to the cargos/{id} endpoint, like the sample data below, the update will be completed. You can update the shipping company with an ID value of 1. (Send a different ID value instead of 1).

```json
{
  "shipping_company": "yurtici"
}
```

### `PUT` Update Shipping Company

**Path:** `api/v1/cargos/{id}/`

When a put request is sent to the cargos/{id} endpoint, like the sample data below, the update of the entire field will be completed. You can update the shipping company with an ID value of 1. (Send a different ID value instead of 1).

```json
{
  "name": "test 001",             # name
  "erp_code": "erp_test_001",     # erp code value
  "shipping_company": "mng"       # courier company enum value
}
```

**Shipping company enum values** are stated below.

### `DELETE` Shipping Company

**Path:** `api/v1/cargos/{id}/`

When a delete request is sent to the cargos/{id} endpoint, like the sample data below, the deletion will be completed. You can delete the shipping company with an ID value of 1. (Send a different ID value instead of 1).

Example path, `cargos/2/`

### `GET` Shipping Company Enum Values

**Path:** `api/v1/cargos/shipping_companies/`

You can get the defined shipping company enum values.

**Response**

```json
{
    "shipping_companies": {
        "hoopkapida": "Hoopkapida Kargo",
        "k_sende": "Kargom Sende",
        "novaposhta": "Nova Poshta",
        "scotty": "Scotty Cargo",
        "arvato": "Arvato",
        "tmmexpress": "TMM Express",
        "fast_cargo": "Fast Cargo",
        "ptt": "Ptt",
        "murat_lgc": "Murat Lojistik",
        "mng": "MNG Kargo",
        "loomis": "Loomis",
        "jetizz": "Jetizz",
        "asil": "Asil Kargo",
        "ups_intl": "UPS International",
        "r2s": "R2S Cargo",
        "giz": "Giz",
        "tyexpress": "Tyexpress",
        "other": "Other",
        "fancourier": "Fan Courier",
        "mylerzsdd": "Mylerz Same Day Delivery",
        "k_gelsin": "Kolay Gelsin",
        "ismail": "Is-Mail Kargo",
        "aras": "Aras Kargo",
        "packupp": "Packupp",
        "ay_cargo": "Ay Kargo",
        "yurtici": "Yurtiçi Kargo",
        "bringo": "Bringo",
        "cainiao": "Cainiao",
        "netkargo": "NetKargo",
        "boomex": "Boomex",
        "carrtell": "Cartell",
        "b2c_direct": "B2C Direct",
        "horoz": "Horoz",
        "aramex": "Aramex",
        "birgunde": "Bir Günde Kargo",
        "dhlexpress": "DHL Express",
        "chrono": "Chrono Diali Courier",
        "mylerz": "Mylerz Cargo",
        "bovo": "Bovo",
        "acs": "ACS Kargo",
        "speeta": "Speeta",
        "dpd": "DPD Cargo",
        "droplight": "DropLight",
        "gelal": "Gelal",
        "surat": "Sürat Kargo",
        "in_post": "In Post",
        "gls": "GLS Logistic",
        "kargo_ist": "Kargo İstanbul",
        "ups": "UPS",
        "hbexpress": "Hepsi Express"
    }
}
```

## Tracking Number

After the successful payment of the products in the customer basket, the numbers of the orders and tracking numbers are collected specifically (cancellation\_waiting, confirmation\_waiting, approved, preparing, shipped, shipped\_and\_informed, ready\_for\_pickup, attempted\_delivery and delivered), and sent to the integrated and adjusted companies in the enums above. After this shipment, the cargo tracking numbers are added by updating the tracking\_number fields of the orders. Customers using the online store are directed to the cargo tracking site of the companies listed in the above enums with the relevant cargo tracking number. With tasks running periodically in the background, this process is automated from end to end.

## Invoice Number

Thanks to our layer inter-integrated to the ERP systems used for issuing invoices, the numbers of the invoice issued upon order are sent to the Omnitron API with an update request. This allows for the invoice number to be processed on the order.


# Cancellations & Refunds

Orders/Orders/Order No: 123123123 should be canceled on the Omnitron’s left sidebar menu.

The detail page is reached by selecting the order to be processed as stated before. Cancellations related to the order can be made on the detail page.

<figure><img src="https://694447771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVufPVrRNtGmK1TUsnRU3%2Fuploads%2F6CYdI039lrcosPPpQ4H9%2Fimage.png?alt=media&amp;token=cce2628d-d8ad-41a2-8011-2ef1816f8397" alt=""><figcaption></figcaption></figure>

***

## Process

During the cancellation process, the `cancel_status` value of the order is checked. If the Cancel\_status field is `CancelStatus.approved`, an OrderUpdateCancelStatusException error will occur when trying to change it from this status to the CancelStatus.confirmed status. If the Cancel\_status field is CancelStatus.waiting\_for\_payment, trying to switch to the following statuses \[waiting,confirmation\_waiting,confirmed,approved,rejected] OrderUpdateCancelStatusException error will occur. If the value is `CancelStatus.waiting`, a `OrderCancelMoreThenOneException` is thrown. A check is performed to determine whether the `is_all` value is `True`, and the `cancel_items` array is full. A check is performed to determine whether the `is_cargo_refund` value is `True`, and the `cancel_items` or `is_all` value is `True`. In case of an error, an OrderCancelOverlappingParameterException is issued.

The canceled product objects are checked for value reasons. In case of an error, an OrderCancelMissingReasonException is issued.

The payment options of the order are checked. If the payment type is credit card, the payment transactions are checked and the order payment amount is calculated. If the payment type is not a credit card, the order amount is taken from the order object. If the Payment\_option field is PaymentType.credit\_card, a payment record is expected. If not, an OrderCancelPurchaseTransactionNotFound error occurs. If the refund amount is less than 0, an OrderCancelNoRefundableAmountException error occurs. If the Payment\_option field is PaymentType.pay\_on\_delivery, the products in the order are checked. If there are order items belonging to different statuses, an OrderCancelMultipleItemStatusException error occurs. Forced\_refund control is performed on order items. If this field is active, forced\_refund\_amount is expected to be delivered, OrderCancelManuallyException error occurs in undelivered transactions.

An OrderCancelMoreThenOneException error occurs if there is a product with the status CancelStatus.waiting, CancelStatus.approved or CancelStatus.manuel\_refund\_need among the order items.

OrderCancelItemsIsNotConsistent error occurs when order items that are to be canceled are delivered, and an item that does not exist on the order is transmitted.

OrderCancelItemMultipleDataSourcesFoundException error occurs when order items have more than one supplier.

​​Cancellation or refund can be made at the same time during the transaction. In this case, requests must be submitted separately. If they are submitted together, a CancelOrderItemMixedException error occurs.

The `can_be_sent_to_erp` value is checked for status approval during the order process.

The payment options of the order are checked. If the payment type is credit card, the payment transactions are checked and the order payment amount is calculated. If the payment type is not a credit card, the order amount is taken from the order object.

If the cancel\_status of the products in the order is \[CancelStatus.waiting,CancelStatus approved or CancelStatus.manuel\_refund\_need], an `OrderCancelMoreThenOneException` is sent.

If the order contains an invoice\_number, the `cancellation_type` will be a refund; if not, it will be cancellation.

If there is a `forced_refund_amount`, the refund is made with the `forced_refund_amount value`. If not, it is calculated with the `calculate_refund` function according to the strategy selected in the settings.

The `CancellationPlan` object is created depending on the order status. If the created `CancellationPlan` status is `confirmation_waiting`, the order cancellation process is completed with the use of the approve or reject buttons on the Front-End.

If the orders are linked to customers" ERP systems, approval is assessed using the `approved_order_cancel` function to obtain approval from the ERP system, and the process is completed by changing the cancellation status of the order.

***

## Statuses

The statuses for the stages of the order cancellation process are provided below.

**omnicore.orders.enums.CancelStatus**

The values ​​that the cancel\_status field that the order can take. Indicates at what stage the cancellation process is on the order.

* waiting,
* confirmation\_waiting,
* confirmed, approved,
* rejected,
* waiting\_for\_payment,
* manuel\_refund\_need,
* completed

**omnicore.orders.enums.CancellationType**

Indicates whether the operation is canceled or refunded on CancellationRequest.

* cancel
* refund

**omnicore.orders.enums.CancellationRequestStatus**

Indicates the stage of the CancellationRequest values ​​that occur with the cancellation request.

* OPEN,
* WAITING,
* CONFIRMATION\_WAITING,
* CONFIRMED,
* WAITING\_APPROVAL,
* APPROVED,
* REJECTED,
* WAITING\_FOR\_PAYMENT,
* MANUEL\_REFUND\_NEED,
* COMPLETED

**omnicore.orders.enums.OrderStatus**

It is stored in the status field on the order and indicates the current stage.

* cancellation\_waiting,
* cancelled, waiting,
* payment\_waiting,
* confirmation\_waiting,
* approved, preparing,
* shipped,
* shipped\_and\_informed,
* ready\_for\_pickup,
* attempted\_delivery,
* review\_started,
* review\_waiting,
* delivered,
* refunded

***

## `POST` Create Cancellation Request

Path: `/api/v1/orders/{order_pk}/cancel/`

```json
{
"order": "<order_pk>",
"is_all": false,
"reasons": {'35': 1},
"forced_refund_amount": "13,12",
"cancel_items": [35,12],
"refund_invoice_number":"123213",
"is_cargo_refund":false,
"retail_store_remote_id":"12",
"staff_remote_id":"1",
"return_details":false
}

```

**Response / 200**

```json
return_details == False     
    {"success": True}      

return_details == True      
    OrderDetailedSerializer.data

```

**Response / 400**

```json
{"order": [u"Invalid pk "123" – object does not exist."]}       
```

**Response / 406**

```json
     {"non_field_errors": u"Order cancel is not valid", "error_code": u"cancel_100"}
```

**Viewset**

Employs the cancel method of the omnitron.orders.resources.views.OrderViewSet Class. With the request, this part is triggered and the cancellation process of the order will start.

**Service**

Employs the cancel method of the omnitron.orders.service.OrderService Class. When the cancellation request is sent, the process will be transmitted with the following service. The parameters received by the service and the return value are listed.

Service name: cancel\_order

Received parameters :

* order
* reasons
* is\_all
* cancel\_items
* forced\_refund\_amount
* is\_cargo\_refund
* refund\_invoice\_number
* next\_status
* ibans
* holder\_names

Return value: Order

**Used Methods**

```
CancellationStrategy
omnitron.orders.service.OrderService._create_cancellation_request
omnitron.orders.service.OrderService._validate_cancellation_info
omnitron.orders.service.OrderService._create_cancellation_plan
omnitron.orders.service.OrderService.approved_order_cancel
```

**Strategy**

During the cancellation process of the order, the `CANCELLATION_STRATEGY` variable in the settings.py file defines the strategies from StrategyOne to StrategyEleven in the strategy.py file on a company basis. Strategy classes are essentially derived from the `omnitron.orders.strategies.CancellationStrategy` class.

\<img src={image2} width="460" style={{'borderRadius':'10px'}}/>

**Serializer**

OrderCancelSerializer: Controls the parameters and structures that can make the request thrown to initiate the cancellation process.

| **Name**                | **Description**                                                                                                                                                      |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| order                   | Orders with statuses other than \[cancelled, refunded, cancellation\_waiting]                                                                                        |
| is\_all                 | <ul><li>boolean</li><li>Default:False</li><li>Used to cancel all products.</li><li>If {<code>true</code>}, the cancel\_items value must be an empty array.</li></ul> |
| cancel\_items           | The order\_item list to be canceled.                                                                                                                                 |
| forced\_refund\_amount  | <ul><li>Decimal</li><li>allow\_null=True</li><li>The field {<code>for</code>} entering the refund amount optionally</li></ul>                                        |
| reasons                 | <ul><li>DictField</li><li>{<code>{order\_item\_id : CancellationReason}</code>}</li><li>Cancellation reason</li></ul>                                                |
| is\_cargo\_refund       | <ul><li>boolean</li><li>required=False</li><li>Cargo refund</li></ul>                                                                                                |
| refund\_invoice\_number | <ul><li>CharField</li><li>required=False, default=None</li><li>Refund invoice number</li></ul>                                                                       |
| ibans                   | <ul><li>DictField</li><li>required=False</li></ul>                                                                                                                   |
| holder\_name            | <ul><li>DictField</li><li>required=False</li></ul>                                                                                                                   |

## `POST` Reject Cancellation Request

Path: `/api/v1/orders/{order_pk}/cancellation_reject_order/`

The method that permits the rejection of the order cancellation process.

**Response / 200**

```
  OrderDetailedSerializer.data
```

**Response / 404**

```
{
    "detail": "Not found."
}
```

**Service**

reject\_order\_cancel method of the omnitron.orders.service.OrderService class is used.

Service name: reject\_order\_cancel

Received parameter: order

Return Value: order

**Used Methods**

```
omnitron.orders.service.OrderService._update_cancellation_request
omnitron.orders.service.OrderService.update_cancellation_plan
```

## `POST` Approve Cancellation Request

Path:`/api/v1/orders/{order_pk}/cancellation_approved_order/`

The method that permits the approval of the order cancellation process.

```json
{
"invoice_number":"1321213123"
}
```

**Response / 200**

```
OrderDetailedSerializer.data
```

**Service**

`approved_order_cancel` method of the omnitron.orders.service.OrderService class is used.

Service name: approved\_order\_cancel

Received parameters:

* order
* invoice\_number
* payment\_plan

Return value: order

**Used Methods**

```
omnitron.orders.service.OrderService._update_cancellation_request
omnitron.orders.service.OrderService.update_cancellation_plan
```

**Serializer**

Controls the parameters and structures of the requester thrown to confirm the cancellation.

`omnitron.orders.resources.serializers.CancellationApprovedOrderSerializer`

* invoice\_number:
  * CharField
  * Default: None
  * Invoice number
* payment\_plan
  * JsonField
  * required=False

## Cancellation Status

It is used to update the cancel\_status fields of orders and order items whose cancellation process has been initiated.

### `POST` Update Cancellation Status

Path: `/api/v1/orders/{order_pk}/update_cancel_status/`

**Request**

```json
{
"cancel_status": "manuel_refund_need",
"order": 45,
"order_items": [118]
}
```

**Response / 200**

```
OrderDetailedSerializer.data
```

**Serializer**

CancelStatusUpdateSerializer: Controls the requesting parameters and structures to update status on cancellation.

* order:
  * Order
* order\_items:
  * ListField
  * required=False
  * OrderItem
* cancel\_status:
  * omnicore.orders.enums.CancelStatus (Values ​​in the Status section)

## Cancellation Requests

The method that permits the creation of cancellation requests. Used for the products in the order. `GET`, `POST`, `PUT` and `DELETE` features are used.

### `GET` Cancellation Requests

Path: `/api/v1/cancellation_requests/`

**Response**

```json
{
    "count": 13,
    "next": "{customer_omnitron_url}/api/v1/cancellation_requests/?page=4",
    "previous": "{customer_omnitron_url}/api/v1/cancellation_requests/?page=2",
    "results": [
        {
            "id": 5,
            "cancellation_type": "refund",
            "status": "open",
            "easy_return": 1,
            "created_date": "2021-06-03T07:25:24.520026Z",
            "modified_date": "2021-06-03T07:25:24.520106Z",
            "uuid": "abcacaec-9644-408b-9b45-ce96847a5d90",
            "description": "Description",
            "iban": "TRXXXXX10009999901234567890",
            "holder_name": "Courier Company Name",
            "reason": 2,
            "order_item": 416
           },..]
}

```

### `GET` Cancellation Request Detail

Path: `/api/v1/cancellation_requests/{id}/`

**Response**

```json
{
  "id": 5,
  "cancellation_type": "refund",
  "status": "open",
  "easy_return": "1",
  "created_date": "2021-06-03T07:25:24.520026Z",
  "modified_date": "2021-06-03T07:25:24.520106Z",
  "uuid": "abcacaec-9644-408b-9b45-ce96847a5d90",
  "description": "Description",
  "iban": "TR320010009999901234567890",
  "holder_name": "Courier Company Name",
  "reason": 2,
  "order_item": 416
}
```

### `PUT` Update Cancellation Request

Path: `/api/v1/cancellation_requests/{id}/`

```json
{
    "id": 5,
    "cancellation_type": "refund",
    "status": "open",
    "easy_return": 1,
    "created_date": "2021-06-03T07:25:24.520026Z",
    "modified_date": "2021-06-03T07:25:24.520106Z",
    "uuid": "abcacaec-9644-408b-9b45-ce96847a5d90",
    "description": "Description",
    "iban": "TR320010009999901234567890",
    "holder_name": "Courier Company Name",
    "reason":1,
    "order_item": 416
}
```

**Response**

```json
{
    "id": 5,
    "cancellation_type": "refund",
    "status": "open",
    "easy_return": 1,
    "created_date": "2021-06-03T07:25:24.520026Z",
    "modified_date": "2021-06-03T07:25:24.520106Z",
    "uuid": "abcacaec-9644-408b-9b45-ce96847a5d90",
    "description": "Description",
    "iban": "TR320010009999901234567890",
    "holder_name": "Courier Company Name",
    "reason": 1,
    "order_item": 416
}
```

### `POST` Create Cancellation Request

Path: `/api/v1/cancellation_requests/`

```json
{
  "order_item": 116,
  "cancellation_type": "refund",
  "reason": 1
}
```

**Response**

```
HTTP200
```

### `DELETE` Cancellation Request

Path: `/api/v1/cancellation_requests/{id}/`

**Response**

```
HTTP204
```

**Viewset**

Uses the omnitron.orders.resources.views.CancellationRequestViewSet class. ViewSet handles requests for CancellationRequest transactions. After the controls are made, the service is triggered to perform the transaction.

**Serializer**

`omnitron.orders.resources.serializers.CancellationRequestSerializer`

Controls the parameters and their structures in requests to the Viewset.

| **Name**             | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Id =                 | IntegerField(label="ID", read\_only=True)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| cancellation\_type = | EnumField(enum\_type=\<enum "CancellationType">)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| status =             | EnumField(enum\_type=\<enum "CancellationRequestStatus">, read\_only=True)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| easy\_return =       | <ul><li>CancellationEasyReturnSerializer(read\_only=True): Easy cancellation model</li><li>id = IntegerField(label="ID", read\_only=True)</li><li>status = EnumField(enum\_type=\<enum "CancellationEasyReturnStatus">, read\_only=True)</li><li>shipping\_company = EnumField(enum\_type=\<enum "ShippingCompany">, read\_only=True)</li><li>created\_date = DateTimeField(read\_only=True)</li><li>modified\_date = DateTimeField(read\_only=True)</li><li>uuid = UUIDField(required=False, validators=\[\<UniqueValidator(queryset=CancellationEasyReturn.objects.all())>])</li><li>code = CharField(max\_length=64, validators=\[\<UniqueValidator(queryset=CancellationEasyReturn.objects.all())>])</li><li>start\_date = DateTimeField(allow\_null=True, required=False)</li><li>end\_date = DateTimeField(allow\_null=True, required=False)</li><li>max\_count = IntegerField(allow\_null=True, max\_value=2147483647, min\_value=0, required=False)</li><li>raw\_request = CharField(style={<code>{"base\_template": "textarea.html"}</code>})</li><li>raw\_response = CharField(style={<code>{"base\_template": "textarea.html"}</code>})</li></ul> |
| created\_date =      | DateTimeField(read\_only=True)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| modified\_date =     | DateTimeField(read\_only=True)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| uuid =               | UUIDField(required=False, validators=\[\<UniqueValidator(queryset=CancellationRequest.objects.all())>])                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| description =        | CharField(allow\_blank=True, allow\_null=True, required=False, style={\`{"base\_template": "textarea.html"}\`})                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| iban =               | CharField(allow\_blank=True, allow\_null=True, max\_length=34, required=False)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| holder\_name =       | CharField(allow\_blank=True, allow\_null=True, max\_length=255, required=False)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| reason =             | PrimaryKeyRelatedField(queryset=CancellationReason.objects.all())                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| order\_item =        | PrimaryKeyRelatedField(queryset=OrderItem.objects.all(), validators=\[\<UniqueValidator(queryset=CancellationRequest.objects.all())>])                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

**Service**

`omnitron.orders.service CancellationRequestApprovalService.create_cancellation_request` method is used.

Service name: create\_cancellation\_request

Received parameters:

* order\_item
* cancellation\_type
* reason
* iban
* holder\_name
* description

Return value: cancellation\_request

## Cancellation Reasons

The class for CREATING, UPDATING and DELETING the selected cancellation reasons during the cancellation process.

### `GET` Cancellation Reasons

Path: `/api/v1/cancellation_reasons/`

**Response**

```json
{
    "count": 11,
    "next": "{customer_omnitron_url}/api/v1/cancellation_reasons/?page=4",
    "previous": "{customer_omnitron_url}/api/v1/cancellation_reasons/?page=2",
    "results": [
        {
            "pk": 1,
            "cancellation_type": "cancel",
            "extra_information_needed": false,
            "order": 100,
            "subject": "I bought wrong product.",
            "is_active": true,
            "send_to_remote": false
        },…]
}
```

### `POST` Create Cancellation Reason

Path: `/api/v1/cancellation_reasons/`

```json
{
    "cancellation_type": "refund",
    "extra_information_needed": true,
    "order": 100,
    "subject": "Cancellation Reason",
    "is_active": true,
    "send_to_remote": false
}
```

**Response**

```json
{
    "pk": 11,
    "cancellation_type": "refund",
    "extra_information_needed": true,
    "order": 100,
    "subject": "Cancellation Reason",
    "is_active": true,
    "send_to_remote": false
}
```

### `PUT` Update Cancellation Reason

Path: `/api/v1/cancellation_reasons/{id}/`

```json
{
    "cancellation_type": "refund",
    "extra_information_needed": true,
    "order": 100,
    "subject": "Another Cancellation Reason",
    "is_active": true,
    "send_to_remote": false
}
```

**Response**

```json
{
    "pk": 11,
    "cancellation_type": "refund",
    "extra_information_needed": true,
    "order": 100,
    "subject": "Another Cancellation Reason",
    "is_active": true,
    "send_to_remote": false
}
```

### `DELETE` Cancellation Reason

Path: `/api/v1/cancellation_reasons/{id}/`

**Response**

```
HTTP204
```

**Viewset**

Uses the omnitron.orders.resources.views.CancellationReasonViewSet class. ViewSet meets requests for cancellation responses. After the controls are made, the service is triggered to perform the transaction.

**Serializer**

omnitron.orders.resources.serializers.CancellationReasonSerializer: Controls the parameters and their structures in requests to the ViewSet.

| **Name**                     | **Description**                                                   |
| ---------------------------- | ----------------------------------------------------------------- |
| pk =                         | IntegerField(label="ID", read\_only=True)                         |
| cancellation\_type =         | EnumField(enum\_type=\<enum "CancellationType">)                  |
| extra\_information\_needed = | BooleanField(required=False)                                      |
| order =                      | IntegerField(max\_value=2147483647, min\_value=0, required=False) |
| subject =                    | CharField(max\_length=100)                                        |
| is\_active =                 | BooleanField(required=False)                                      |
| send\_to\_remote =           | BooleanField(required=False)                                      |

**Service**

The omnitron.orders.service.CancellationReasonService class is derived from the omnicore.orders.service.BaseCancellationReasonService class. Adding, deleting and updating transactions are done through the Services.

Service name: create\_cancellation\_reason

Received parameters:

* subject
* cancellation\_type
* extra\_information\_needed(default=False)
* order(default=100)

Return value: CancellationReason

Service name: update\_cancellation\_reason

Received parameters:

* instance
* subject(default=None)

Return value: instance

Service name: delete\_cancellation\_reason

Received parameters: instance

## Cancellation Plans

The cancellation\_plan is created when the cancellation process is started for the order. It is used to update the status of the CancellationPlan record.

### `GET` Cancellation Plan Statuses

Path: `/api/v1/cancellation_plans/cancellation_plan_statuses/`

**Response**

```json
{
    "cancellation_plan_statuses": {
        "confirmed": "Confirmed",
        "manuel_refund_need": "Manuel Refund Need",
        "completed": "Completed",
        "confirmation_waiting": "Confirmation Waiting",
        "rejected": "Rejected",
        "failed": "Failed",
        "waiting": "Waiting",
        "cancelled": "Cancelled",
        "waiting_for_payment": "Waiting For Payment",
        "approved": "Approved"
    }
}
```

### `POST` Update Cancellation Plan Status

Path: `/api/v1/cancellation_plans/{pk}/update_status/`

```json
{
    "order":32,
    "status": "waiting"
}
```

**Response**

```
HTTP200
```

**Viewset**

Uses the omnitron.orders.resources.views.CancellationPlanViewSet class. Derived from rest\_framework.viewsets.ReadOnlyModelViewSet and omnitron.channels.resources.views.IntegrationMappingMixin classes.

CancellationPlan records allow services to be triggered by responding to status update or current status requests.

**Serializer**

omnitron.orders.resources.serializers.CancellationPlanSerializer: Controls parameters and structures in delivered requests.

| **Name**                         | **Description**                                                  |
| -------------------------------- | ---------------------------------------------------------------- |
| order =                          | OrderSerializer()                                                |
| order\_previous\_status =        | EnumField(enum\_type=OrderStatus)                                |
| status =                         | EnumField(enum\_type=CancellationPlanStatus)                     |
| plan\_type =                     | EnumField(enum\_type=CancellationPlanType)                       |
| cancellationplanorderitem\_set = | CancellationPlanOrderItemSerializer( many=True, read\_only=True) |
| invoice\_number =                | serializers.CharField(required=False)                            |
| created\_by =                    | UserSerializer()                                                 |
| last\_updated\_by =              | serializers.SerializerMethodField()                              |

**Service**

Uses the omnitron.orders.service.CancellationPlanService class. Contains the status update service triggered by the View.

Service name: update\_status

Received parameters:

* instance
* Status

Return value: instance


# Retail Stores


# Retail Stores

Embodies the actual retail locations where the product is sold.

Users can add/delete/update stores in Omnitron with `GET`, `POST`, `PATCH`, `PUT` and `DELETE` requests via `api/v1/retail_stores/` endpoint.

## `GET` Retail Stores

Path: `api/v1/retail_stores/`

Path: `api/v1/retail_stores/&lt;pk>/`

When a `GET` request is made directly from retail\_stores/, users can get all stores. If a user sends a `GET` request like `retail_stores/1/` they will get the store with ID value 1 (instead of 1 send the id you need). Associated data has only an ID value.

```json
{
   "count": 5,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Shop 1",
           "township": 1,
           "district": 5,
...
```

Path: `api/v1/retail_stores/detailed/`

Path: `api/v1/retail_stores/<pk>/detailed/`

Sending a request to the detailed/ endpoint will result in a list of properties of the related data.

```json
{
   "count": 5,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Shop 1",
           "township": {
               "pk": 1,
               "is_active": true,
               "name": "Test Township 1",
               "city": {
                   "pk": 1,
...
```

## `POST` Create a Retail Store

Parameters for creating a retail store are displayed in the table below.

| **Parameter**       | **Data Type** | **In** | **Required** | **Description**                                                    |
| ------------------- | ------------- | ------ | ------------ | ------------------------------------------------------------------ |
| authorization       | string        | header | YES          | [The API key of the customer’s account](/omnitron/getting-started) |
| name                | string        | body   | YES          | Name of the store                                                  |
| address             | string        | body   | YES          | Address details                                                    |
| township            | ID            | body   | YES          | Township ID value                                                  |
| phone\_number       | string        | body   | YES          | Phone number                                                       |
| channels            | ID List       | body   | YES          | Sales channel ID values                                            |
| store\_type         | ID or null    | body   | YES          | Store type ID value                                                |
| fax\_phone\_number  | string        | body   | YES          | Fax phone number                                                   |
| click\_and\_collect | Boolean       | body   | YES          | Permission for getting products from Store                         |
| store\_hours        | List          | body   | YES          | Work hours                                                         |
| is\_active          | Boolean       | body   | YES          | Activity status                                                    |
| district            | ID            | body   |              | District ID value                                                  |
| latitude            | number        | body   |              | Latitude                                                           |
| longitude           | number        | body   |              | Longitude                                                          |
| kapida\_enabled     | boolean       | body   |              | A field specific to a project                                      |
| fast\_delivery      | boolean       | body   |              | Status of fast delivery                                            |
| erp\_code           | string        | body   |              | Store erp code                                                     |

When a post request is made to the retail\_stores/ endpoint, such as the example data below, the creation process takes place.

Path: `api/v1/retail_stores/`

**Request**

```json
{

"name":"test-u-1",
"address":"test address text",
"township":1,
"phone_number":"02129998877",
"channels":[1],
"is_active":true,
"store_type": null,
"fax_phone_number": "02129998877",
"click_and_collect": false,
"store_hours": [
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"],
["09:00:00","19:00:00"]
]
}
```

**Response**

```json
{
   "pk": 11,
   "name": "test-u-1",
   "township": 1,
   "district": null,
   "address": "test address text",
   "phone_number": "02129998877",
   "fax_phone_number": "02129998877",
   "image": null,
   "store_hours": [
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ],
       [
           "09:00:00",
           "19:00:00"
       ]
   ],
   "latitude": null,
   "longitude": null,
   "is_active": true,
   "click_and_collect": false,
   "store_type": null,
   "kapida_enabled": false,
   "fast_delivery": false,
   "config": {},
   "group": null,
   "sort_order": null,
   "channels": [
       1
   ],
   "erp_code": null,
   "modified_date": "2022-12-23T09:33:42.986845Z",
   "created_date": "2022-12-23T09:33:42.986832Z"
}

```

Access the data below for the District, Township, Channels and Store Type that you will need in order to use the above request.

District: Get it by sending a GET request to the `api/v1/districts/` endpoint.

Township: Get it by sending a GET request to the `api/v1/townships/` endpoint.

Channels: Get it by sending a GET request to the `api/v1/channels/` endpoint.

Store Type: : Get it by sending a GET request to the `api/v1/retailstore_type/` endpoint.

## `PATCH` Modify an Existing Retail Store

When a patch request, such as the sample data below, is sent to the retail\_stores/ID/ endpoint, the update process will be completed. Update the store whose ID value is 1 (replace 1 with the ID value you need).

Path: `api/v1/retail_stores/{pk}/`

```json
{
  "name": "New Test Retail Store",                          # Retail Store Name
  "township": 453,                                          # Township ID Value
  "address": "Test district Test street, Test building",    # Address Detail
  "phone_number": "02129998811",                            # Phone Number
  "district": 32445,                                        # District ID Value
}

```

Access the data below for the District, Township, Channels and Store Type that you will need to use the above request.

District: Get it by sending a GET request to the `api/v1/districts/` endpoint.

Township: Get it by sending a GET request to the `api/v1/townships/` endpoint.

Channels: Get it by sending a GET request to the `api/v1/channels/` endpoint.

Store Type: Get it by sending a GET request to the `api/v1/retailstore_type/` endpoint

## `PUT` Modify an existing Retail Store

When a `PUT` request is sent like the example data below to the retail\_stores/ID/ endpoint, the entire field will be updated. Update the store whose ID value is 1 (replace 1 with the ID value you need).

Path: `api/v1/retail_stores/{pk}/`

```json
{
  "name": "Test Retail Store",                   # Retail Store Name
  "township": 454,                               # Township ID Value
  "address": "Test district test street",        # Address Detail
  "phone_number": "02129998877",                 # Phone Number
  "fax_phone_number": null,                      # Fax Phone Number
  "is_active": true,                             # Status of Activity
  "click_and_collect": false,                    # Permission for getting products from Store
  "store_type": null,                            # Store Type ID Value
  "erp_code": "test_retail_store",               # ERP Code Value
  "district": 35485,                             # District ID Value
  "channels": [1],                               # Sale Channels ID Values
  "store_hours": [                               # Work Hours
    ["09:00", "18:00"],
    ["09:00", "18:00"],
    ["09:00", "18:00"],
    ["09:00", "18:00"],
    ["09:00", "18:00"],
    ["09:00", "12:00"],
    ["10:00", "12:00"]
  ]
}

```

Access the data below for the District, Township, Channels and Store Type that you will need to use the above request.

District: Get it by sending a GET request to the `api/v1/districts/` endpoint.

Township: Get it by sending a GET request to the `api/v1/townships/` endpoint.

Channels: Get it by sending a GET request to the `api/v1/channels/` endpoint.

Store Type: Get it by sending a GET request to the `api/v1/retailstore_type/` endpoint.

## `DELETE` Retail Store

When a delete request is sent like the example data below to the retail\_stores/ID/ endpoint the deletion will be completed. Delete the store with ID value of 1 (substitute with ID value you need). This will update the is\_active value to False, but won’t delete the relevant model.

Path: `api/v1/retail_stores/{pk}/`

## Special Endpoints

***

**add\_districts**

Provide a new neighborhood definition to the config value of the store by sending a POST request to the `/api/v1/retail_stores/{retail_stores_id}/add_districts/` endpoint.

### `POST` Add Districts to a Retail Store

Path: `/api/v1/retail_stores/{retail_stores_id}/add_districts/`

```json
{
  "districts": [35482, 35411, 35213], # defining multiple district values
}

```

***

**remove\_districts**

Send a `POST` request to `/api/v1/retail_stores/{retail_stores_id}/remove_districts/endpoint` so that a new neighborhood is deleted in the config value of the store.

### `POST` Remove Districts in a Retail Store

Path: `/api/v1/retail_stores/{retail_stores_id}/remove_districts/`

```json
{
  "districts": [35482, 35411], # removing multiple district values
}
```


# User Management


# Roles & Permissions

Stores the information of the users via the Omnitron application. There are two types of users on Omnitron:

* Super User
* Staff

## User Types

* **Super User**

  These users can view all the menus and take all kinds of actions in the Omnitron application. They are controlled with the `is_superuser` field in the User model.
* **Staff**

  Users can view Omnitron menus depending on the authorization groups. They are controlled with the is\_staff field in the User model.

## User Property Fields

There are mandatory and optional user property fields:

**Mandatory Fields**

* Username
  * The user’s username on the Omnitron application. Must be unique.
  * Must be 150 characters or less. Only accepts letters, numbers and “@.+-\_” characters.
* Name
* Surname
* Email
* Password

**Optional Fields**

* General Authorization Groups
  * Determines the menus, buttons, etc., on the Omnitron interface visible to users who have been defined as staff.
* Catalog Authorization Group
  * Determines the categories visible to the user.
* Channel Authorization Group
  * Determines the sales channels visible to the user in the “Sales Channels” menu.
* Phone
* Avatar
* Super User
  * The variable that grants the user full authority on the Omnitron interface.
  * Grants access to all menus regardless of authorization groups.
* Staff
  * Normal users. The menus visible to these users in the Omnitron software depends on the authorization groups.
* Active/Inactive
  * If the user is inactive, they are prevented from logging into the Omnitron software.

## Serializer

This serializer is used for data validation and representation for the request/response life cycle. Contains particular fields in addition to the Django auth user model.

* `username`: Unique identifier of the user.
* `first_name`: Name.
* `last_name`: Surname.
* `email`: Email address.
* `is_staff`: The boolean value for staff indication.
* `is_superuser`: The boolean value for super user indication.
* `is_active`: Activation status.
* `groups`: User authorization groups. Their PK value reflects the Django auth group model. It can take multiple values.
* `date_joined`: Registration date.
* `last_login`: Date value of the last successful login.

## ViewSet

| **Endpoints**             |
| ------------------------- |
| /api/v1/users/            |
| {\`/api/v1/users/{pk}/\`} |

**Allowed HTTP Requests:**

* GET
* POST
* PUT
* PATCH
* DELETE

**Potential Responses:**

* 200 OK
* 201 Created
* 204 No Content
* 400 Bad Request
* 401 Unauthorized
* 404 Not Found
* 406 Not Acceptable

### `GET` Users

This endpoint can be used to retrieve all users as a list.

Path: `/api/v1/users/`

**Response**

```json

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"username": "foo",
"first_name": "bar",
"last_name": "baz",
"email": "qux@akinon.com",
"is_staff": true,
"is_active": true,
"date_joined": "2022-12-21T10:32:51.707174Z",
"last_login": "2022-12-21T12:21:30.684071Z",
"is_superuser": true,
"groups": [1, 2, 3]
},
…
]
}

```

### `GET` User Search

This endpoint can be used to retrieve all users that match the given search parameters as a list.

Path: `/api/v1/users/?pk__in={user_pk},{user_pk},{user_pk}&is_admin={true|false}&is_staff={true|false}&username={username}&email={user_email}&first_name={first_name}&last_name={last_name}`

| **Parameter** | **Description**                                                                       |
| ------------- | ------------------------------------------------------------------------------------- |
| pk\_\_in      | Permits fetching users with a known PK                                                |
| is\_admin     | Permits the filtering of admin users and normal users                                 |
| is\_staff     | Permits the filtering of staff users and normal users                                 |
| username      | Queries whether there are any registered users associated with the given username     |
| first\_name   | Queries whether there are any registered users associated with the given first\_name  |
| last\_name    | Queries whether there are any registered users associated with the given last\_name   |
| email         | Queries whether there are any registered users associated with the sent email address |

**Response**

```json
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "pk": 1,
            "username": "foo",
            "first_name": "bar",
            "last_name": "baz",
            "email": "qux@akinon.com",
            "is_staff": true,
            "is_active": true,
            "date_joined": "2022-12-21T10:32:51.707174Z",
            "last_login": "2022-12-21T12:21:30.684071Z",
            "is_superuser": true,
            "groups": [1, 2, 3]
        },
        …
    ]
}
```

### **`GET` User Detail​**

This endpoint can be used to retrieve a user that is paired with the given {PK} value.

Path: `/api/v1/users/{PK}/`

**Response**

```json
{
    "pk": 1,
    "username": "foo",
    "first_name": "bar",
    "last_name": "baz",
    "email": "qux@akinon.com",
    "is_staff": true,
    "is_active": true,
    "date_joined": "2022-12-21T10:32:51.707174Z",
    "last_login": "2022-12-21T12:21:30.684071Z",
    "is_superuser": true,
    "groups": [1, 2, 3]
}
```

### `POST` Create User

This endpoint can create a new user according to the input. According to the serializer section the following input model must be used.

| **Field**     | **Type**          | **Mandatory** | **Default** |
| ------------- | ----------------- | ------------- | ----------- |
| username      | string            | Yes           | N/A         |
| password      | strin&#x67;**\*** | Yes           | N/A         |
| email         | string            | Yes           | N/A         |
| groups        | list(integer)     | Yes           | N/A         |
| first\_name   | string            | No            | None        |
| last\_name    | string            | No            | None        |
| is\_active    | boolean           | No            | True        |
| is\_staff     | boolean           | No            | False       |
| is\_superuser | boolean           | No            | False       |

**Note:** Password is required to have at least eight characters, including a capital letter, a number, and a special character.

Path: `/api/v1/users/`

```json
{
    "username": "foo",
    "password": "Bar123*!",
    "email": "baz@akinon.com",
    "groups": [1, 2, 3]
}
```

**Response**

```json
{
    "pk": 2,
    "username": "foo",
    "first_name": "",
    "last_name": "",
    "email": "baz@akinon.com",
    "is_staff": false,
    "is_active": true,
    "date_joined": "2022-12-21T09:15:38.123104Z",
    "last_login": null,
    "is_superuser": false,
    "groups": [1, 2, 3]
}
```

### `PATCH` Update User

This endpoint can partially update a user according to the input. According to the serializer section the following input model must be used.

| **Field**     | **Type**          | **Mandatory** | **Default** |
| ------------- | ----------------- | ------------- | ----------- |
| username      | string            | No            | N/A         |
| password      | strin&#x67;**\*** | No            | N/A         |
| email         | string            | No            | N/A         |
| groups        | list(integer)     | No            | N/A         |
| first\_name   | string            | No            | None        |
| last\_name    | string            | No            | None        |
| is\_active    | boolean           | No            | True        |
| is\_staff     | boolean           | No            | False       |
| is\_superuser | boolean           | No            | False       |

**Note:** Password is required to have at least eight characters, including a capital letter, a number, and a special character.

Path: `/api/v1/users/{pk}/`

```
{
    "is_superuser": true,
    "is_active": false
}
```

**Response**

```json
{
    "pk": 2,
    "username": "foo",
    "first_name": "",
    "last_name": "",
    "email": "baz@akinon.com",
    "is_staff": true,
    "is_active": false,
    "date_joined": "2022-12-21T09:15:38.123104Z",
    "last_login": null,
    "is_superuser": true,
    "groups": [1, 2, 3]
}
```

### `PUT` Update User

This endpoint can update a user according to the input. According to the serializer section this input model must be used.

Path: `/api/v1/users/{pk}/`

```json
{
    "username": "foo",
    "first_name": "qux",
    "password": "Bar123*!",
    "email": "baz@akinon.com",
    "groups": [1, 2, 3]
}
```

**Response**

```json
{
    "pk": 2,
    "username": "foo",
    "first_name": "qux",
    "last_name": "",
    "email": "baz@akinon.com",
    "is_staff": true,
    "is_active": false,
    "date_joined": "2022-12-21T09:15:38.123104Z",
    "last_login": null,
    "is_superuser": true,
    "groups": [1, 2, 3]
}
```

### `DELETE` User

Path: `/api/v1/users/{pk}/`

It does not permanently delete the user. It changes `is_active` value to False.

**Response**

204: No Content.


# Add & Remove

## User App

Django web framework features a very useful user identification and permission infrastructure. In this context, it includes Users for user identification, Permissions for assigning users the permission to undertake certain jobs, and Groups for grouping the permission(s) to be assigned to multiple users.

In Omnitron, this infrastructure provided by Django has been inherited and expanded, and the “Users” application has been developed for all user operations: from creating users to defining roles and permissions for users. The application contains the models listed below.

* UserProfile -> The model for defining users.
* BEPermissionNamespace -> The namespace model for backend user permissions.
* BEPermission -> The model for defining backend permissions.
* FEPermissionGroup -> The model for defining the general permission groups of users.
* FEPermission -> The model for defining frontend permissions.
* CatalogGroup -> The model for defining the permission groups of users on the catalog(s).
* ChannelGroup -> The model for defining the permission groups of users on the channel(s).

Storing user information, UserProfile is used by expanding on the User and AbstractUser classes of Django. The AbstractUser model inherits from the PermissionMixin and AbstractBaseUser models. PermissionMixin permits the defining of user-specific permissions with the user\_permission field. In addition, the User’s current status can be defined by fields such as is\_active, is\_superuser, and is\_staff. These are the features that Django offers as part of user management.

### User Screens

User information can be accessed, new users can be added and the properties of existing users can be changed from **Settings> Users** on Omnitron V2.

In the general permission groups section, permission groups can be defined for existing users. Outside of general permission groups, the user access permission breakdown can also be increased with catalog permission groups (permissions for access to the catalogs application) and channel permission groups (permission for access to the channels application). ViewSet Users application includes UserViewSet, ActiveUserViewSet, BEPermissionViewSet, FEPermissionViewSet, FEPermissionGroupViewSet, BEPermissionNamespaceViewSet, GroupViewSet, CatalogGroupViewSet, and ChannelGroupViewSet. Below are the endpoints of these viewsets and sample request-response information for some of them.

**UserViewSet**

| **Endpoints**           |
| ----------------------- |
| /api/v1/users/          |
| {"/api/v1/users/{pk}/"} |

### `GET` All Users

Path: `/api/v1/users/`

Returns all objects in the User table paged.

**Response**

```json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"username": "foo",
"first_name": "bar",
"last_name": "baz",
"email": "qux@akinon.com",
"is_staff": true,
"is_active": true,
"date_joined": "2022-12-21T10:32:51.707174Z",
"last_login": "2022-12-21T12:21:30.684071Z",
"is_superuser": true,
"groups": [1, 2, 3]
},
…
]
}

```

### `POST` Create a New User

Path: `/api/v1/users/`

Records new objects in the User table. Uses the UserSerializer class defined at omnitron.users.resources.serializers for data verification.

| **Field**     | **Type**          | **Mandatory** | **Default** |
| ------------- | ----------------- | ------------- | ----------- |
| username      | string            | Yes           | N/A         |
| password      | strin&#x67;**\*** | Yes           | N/A         |
| email         | string            | Yes           | N/A         |
| groups        | list(integer)     | Yes           | N/A         |
| first\_name   | string            | No            | None        |
| last\_name    | string            | No            | None        |
| is\_active    | boolean           | No            | True        |
| is\_staff     | boolean           | No            | False       |
| is\_superuser | boolean           | No            | False       |

**Note:** Password is required to have at least eight characters, including a capital letter, a number, and a special character.

```json
{
  "username": "foo",
  "password": "Bar123*!",
  "email": "baz@akinon.com",
  "groups": [1, 2, 3]
}
```

**Response**

```json
{
  "pk": 2,
  "username": "foo",
  "first_name": "",
  "last_name": "",
  "email": "baz@akinon.com",
  "is_staff": false,
  "is_active": true,
  "date_joined": "2022-12-21T09:15:38.123104Z",
  "last_login": null,
  "is_superuser": false,
  "groups": [1, 2, 3]
}
```

### `GET` User Detail

Path: `/api/v1/users/{pk}/`

Returns the object specified with the primary key in the User table by serializing it with the UserSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "pk": 1,
  "username": "foo",
  "first_name": "bar",
  "last_name": "baz",
  "email": "qux@akinon.com",
  "is_staff": true,
  "is_active": true,
  "date_joined": "2022-12-21T10:32:51.707174Z",
  "last_login": "2022-12-21T12:21:30.684071Z",
  "is_superuser": true,
  "groups": [1, 2, 3]
}
```

### `PATCH` Update User

Path: `/api/v1/users/{pk}/`

Updates the object of the relevant primary key in the User table. Updates the provided parameters.

| **Field**     | **Type**          | **Mandatory** | **Default** |
| ------------- | ----------------- | ------------- | ----------- |
| username      | string            | No            | N/A         |
| password      | strin&#x67;**\*** | No            | N/A         |
| email         | string            | No            | N/A         |
| groups        | list(integer)     | No            | N/A         |
| first\_name   | string            | No            | None        |
| last\_name    | string            | No            | None        |
| is\_active    | boolean           | No            | true        |
| is\_staff     | boolean           | No            | false       |
| is\_superuser | boolean           | No            | false       |

**Note:** password is required to have at least eight characters, including a capital letter, a number, and a special character.

```
{
   "first_name": "Very Very New"
}
```

Response / 200 Serialized version of the object. Example response of the POST method can be observed.

Response / 400 When a request is made with an incorrect PK, the following response is returned. Here, the HTTP code in the response to the HTTP request will be 404.

```
{
   "detail": "Not found."
}
```

### `PUT` Update User

Path: `/api/v1/users/{pk}/`

Updates the object of the relevant *primary key* in the User table. Updates all fields of the object. All required fields in the *body* of this method must be sent. The POST method can be examined for the fields that can be sent.

```json
{
  "username": "foo",
  "first_name": "qux",
  "password": "Bar123*!",
  "email": "baz@akinon.com",
  "groups": [1, 2, 3]
}
```

Response / 200 Serialized version of the object. Sample response of the POST method can be observed.

Response / 400 When a request is made with an incorrect PK, the following response is returned. Here, the HTTP code in the response to the HTTP request will be 404.

```
{
   "detail": "Not found."
}
```

### `DELETE` User

Path: `/api/v1/users/{pk}/`

Permits the removal of the object specified by the *primary key* from the User table.

**Response**

Response / 204 When a deletion request is completed.

Response / 400 When a request is made with an incorrect PK, the following response is returned. Here, the HTTP code in the response to the HTTP request will be 404.

```
{
   "detail": "Not found."
}
```

## Other Viewsets and Endpoints

## ActiveUserViewSet

This ViewSet always uses the current user which is determined by the request as a resource.

| **Endpoints**                          |
| -------------------------------------- |
| /api/v1/active\_user/                  |
| /api/v1/active\_user/change\_password/ |

### `GET` Active User

Path: `/api/v1/active_user/`

Returns current user object as paged response.

**Response**

```json

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"username": "foo",
"first_name": "bar",
"last_name": "baz",
"email": "qux@akinon.com",
"is_staff": true,
"is_active": true,
"date_joined": "2022-12-21T10:32:51.707174Z",
"last_login": "2022-12-21T12:21:30.684071Z",
"is_superuser": true,
"groups": [1, 2, 3]
},
…
]
}

```

### `PUT` Update Active User

Path: `/api/v1/active_user/`

Updates current user in the User table. Uses the ActiveUserSerializer class defined at omnitron.users.resources.serializers for data verification.

| **Field**   | **Type**                                  | **Mandatory** | **Default** |
| ----------- | ----------------------------------------- | ------------- | ----------- |
| username    | string                                    | Yes           | N/A         |
| email       | string                                    | No            | N/A         |
| first\_name | string                                    | No            | N/A         |
| last\_name  | string                                    | No            | N/A         |
| userprofile | {`Dict{<br>Avatar,<br>Phone Number<br>}`} | Yes           | N/A         |

```json
{
  "username": "admin",
  "first_name": "foo",
  "last_name": "bar",
  "email": "qux@akinon.com",
  "userprofile": {
    "avatar": "{FILE}",
    "phone_number": "+901231231212"
  }
}
```

**Response**

```json
{
  "pk": 1,
  "username": "admin",
  "first_name": "foo",
  "last_name": "bar",
  "email": "qux@akinon.com",
  "date_joined": "2022-12-15T10:32:51.707174Z",
  "last_login": "2022-12-22T09:27:26.361642Z",
  "groups": [{ "pk": 1, "name": "Sample Group" }],
  "userprofile": {
    "pk": 1,
    "avatar": null,
    "phone_number": "+901231231212"
  }
}
```

### `PATCH` Partially Update Active User

Path: `/api/v1/active_user/`

Partially updates current user in the User table. Uses the ActiveUserSerializer class defined at omnitron.users.resources.serializers for data verification.

| **Field**   | **Type**                                  | **Mandatory** | **Default** |
| ----------- | ----------------------------------------- | ------------- | ----------- |
| username    | string                                    | No            | N/A         |
| email       | string                                    | No            | N/A         |
| first\_name | string                                    | No            | N/A         |
| last\_name  | string                                    | No            | N/A         |
| userprofile | {`Dict{<br>Avatar,<br>Phone Number<br>}`} | No            | N/A         |

```
{
    "first_name": "fred",
    "userprofile": {
        "phone_number": "+900000000"
    }
}
```

**Response**

```json
{
  "pk": 1,
  "username": "admin",
  "first_name": "fred",
  "last_name": "bar",
  "email": "qux@akinon.com",
  "date_joined": "2022-12-15T10:32:51.707174Z",
  "last_login": "2022-12-22T09:27:26.361642Z",
  "groups": [],
  "userprofile": {
    "pk": 1,
    "avatar": null,
    "phone_number": "+900000000"
  }
}
```

### `PUT` Change Active User’s Password

Path: `/api/v1/active_user/change_password/`

Updates current user in the User table. Uses the ChangePasswordSerializer class defined at omnitron.users.resources.serializers for data verification.

```
{
    "old_password": "{CURRENT PASSWORD}",
    "new_password": "{NEW PASSWORD}"
}

```

The new password is required to have at least eight characters, including a capital letter, a number, and a special character. Also, it must be different from the last two passwords used. There will be a 400 Bad Request response if the given new password does not match the specified criteria.

**Response**

```json
{
  "old_password": "{CURRENT PASSWORD}",
  "new_password": "{NEW PASSWORD}"
}
```

## BEPermissionNamespaceViewSet

| **Endpoints**                                              |
| ---------------------------------------------------------- |
| /api/v1/be\_permission\_namespace/                         |
| {\`/api/v1/be\_permission\_namespace/{PK}/\`}              |
| {\`/api/v1/be\_permission\_namespace/{PK}/assign-users/\`} |
| {\`/api/v1/be\_permission\_namespace/{PK}/remove-users/\`} |

### `GET` User Permission Scope

Path: `/api/v1/be_permission_namespace/`

Returns by *serializing* all records in the BEPermissionNamespace table with the BEPermissionNamespaceSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "count": 19,
  "next": "{OMNITRON}/api/v1/be_permission_namespace/?page=2",
  "previous": null,
  "results": [
    {
      "pk": 1,
      "name": "products",
      "users": [],
      "modified_date": "2021-08-25T09:22:54.538000Z",
      "created_date": "2021-08-25T09:22:54.538000Z"
    },
    {
      "pk": 2,
      "name": "catalogs",
      "users": [],
      "modified_date": "2021-08-25T09:22:54.750000Z",
      "created_date": "2021-08-25T09:22:54.750000Z"
    },
    {
      "pk": 3,
      "name": "customers",
      "users": [],
      "modified_date": "2021-08-25T09:22:55.260000Z",
      "created_date": "2021-08-25T09:22:55.260000Z"
    },
    {
      "pk": 4,
      "name": "address",
      "users": [],
      "modified_date": "2021-08-25T09:22:55.290000Z",
      "created_date": "2021-08-25T09:22:55.290000Z"
    },
    {
      "pk": 5,
      "name": "orders",
      "users": [],
      "modified_date": "2021-08-25T09:22:55.573000Z",
      "created_date": "2021-08-25T09:22:55.573000Z"
    },
    {
      "pk": 6,
      "name": "channels",
      "users": [],
      "modified_date": "2021-08-25T09:22:56.209000Z",
      "created_date": "2021-08-25T09:22:56.209000Z"
    },
    {
      "pk": 7,
      "name": "errors",
      "users": [],
      "modified_date": "2021-08-25T09:22:56.260000Z",
      "created_date": "2021-08-25T09:22:56.260000Z"
    },
    {
      "pk": 8,
      "name": "api",
      "users": [],
      "modified_date": "2021-08-25T09:22:56.297000Z",
      "created_date": "2021-08-25T09:22:56.297000Z"
    },
    {
      "pk": 9,
      "name": "users",
      "users": [],
      "modified_date": "2021-08-25T09:22:56.332000Z",
      "created_date": "2021-08-25T09:22:56.332000Z"
    }
  ]
}
```

### `GET` Detailed User Permission Scope

Path: `/api/v1/be_permission_namespace/{PK}`

Returns by *serializing* requested records matching the given PK in the BEPermissionNamespace table with the BEPermissionNamespaceSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "pk": 1,
  "name": "products",
  "users": [],
  "modified_date": "2021-08-25T09:22:54.538000Z",
  "created_date": "2021-08-25T09:22:54.538000Z"
}
```

### `PATCH` Assign Users to a User Permission Scope

Path: `/api/v1/be_permission_namespace/{PK}/assign-users/`

Assigns given users to the record matching the given PK in the BEPermissionNamespace table.

```
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
  "pk": 1,
  "name": "products",
  "users": [1, 2],
  "modified_date": "2021-08-25T09:22:54.538000Z",
  "created_date": "2021-08-25T09:22:54.538000Z"
}
```

### `PATCH` Remove Users from a User Permission Scope

Path: `/api/v1/be_permission_namespace/{PK}/remove-users/`

Removes given users from the record matching the given PK in the BEPermissionNamespace table.

```
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
  "pk": 1,
  "name": "products",
  "users": [],
  "modified_date": "2021-08-25T09:22:54.538000Z",
  "created_date": "2021-08-25T09:22:54.538000Z"
}
```

## BEPermissionViewSet

| **Endpoints**                                    |
| ------------------------------------------------ |
| /api/v1/be\_permissions/                         |
| {\`/api/v1/be\_permissions/{PK}/\`}              |
| {\`/api/v1/be\_permissions/{PK}/assign-users/\`} |
| {\`/api/v1/be\_permissions/{PK}/remove-users/\`} |

### `GET` User Permissions

Path: `/api/v1/be_permissions/`

Returns by *serializing* all records in the BEPermissions table with the BEPermissionSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
    "count": 2057,
    "next": "{OMNITRON}/api/v1/be_permissions/?limit=1&page=2",
    "previous": null,
    "results": [
        {
            "pk": 1,
            "name": "products-post-api/v1/products/$",
            "namespace": 1,
            "action": "post",
            "path": "api/v1/products/$",
            "users": [],
            "modified_date": "2021-08-25T09:22:54.540000Z",
            "created_date": "2021-08-25T09:22:54.540000Z"
        }
    ],
    …
}
```

### `GET` Detailed User Permission

Path: `/api/v1/be_permissions/{PK}/`

Returns by *serializing* requested records matching the given PK in the BEPermission table with the BEPermissionSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "pk": 1,
  "name": "products-post-api/v1/products/$",
  "namespace": 1,
  "action": "post",
  "path": "api/v1/products/$",
  "users": [],
  "modified_date": "2021-08-25T09:22:54.540000Z",
  "created_date": "2021-08-25T09:22:54.540000Z"
}
```

### `PATCH` Assign Users to a User Permission

Path: `/api/v1/be_permission/{PK}/assign-users/`

Assigns given users to the record matching the given PK in the BEPermission table.

```json
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
  "pk": 1,
  "name": "products-post-api/v1/products/$",
  "namespace": 1,
  "action": "post",
  "path": "api/v1/products/$",
  "users": [1, 2],
  "modified_date": "2021-08-25T09:22:54.540000Z",
  "created_date": "2021-08-25T09:22:54.540000Z"
}
```

### `PATCH` Remove Users from a User Permission

Path: `/api/v1/be_permission/{PK}/remove-users/`

Removes given users from the record matching the given PK in the BEPermission table.

```
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
  "pk": 1,
  "name": "products-post-api/v1/products/$",
  "namespace": 1,
  "action": "post",
  "path": "api/v1/products/$",
  "users": [],
  "modified_date": "2021-08-25T09:22:54.540000Z",
  "created_date": "2021-08-25T09:22:54.540000Z"
}
```

## GroupViewSet

| **Endpoints**              |
| -------------------------- |
| /api/v1/groups/            |
| {\`/api/v1/groups/{PK}/\`} |

### `GET` User Permission Groups

Path: `/api/v1/groups/`

Retrieves records from the Group table in the django.contrib.auth.models module that comes with Django. User permission groups are saved in this table. The Group table is defined as *Foreign Key* in the CatalogGroup and ChannelGroup tables on Omnitron.

**Response**

```json
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 1,
      "name": "Shop Catalog Group"
    },
    {
      "pk": 2,
      "name": "Shop Channel Group"
    }
  ]
}
```

### `POST` Create a New Permission Group

Path: `/api/v1/groups/`

Adds a record to the Group table in the django.contrib.auth.models module included with Django.

```
{
  "name": "test group"
}
```

**Response**

```json
{
  "pk": 3,
  "name": "test group"
}
```

### `PATCH`-`PUT` Update a Permission Group

Path: `/api/v1/groups/{PK}/`

Updates the record that matches the given PK value in the Group table in the django.contrib.auth.models module included with Django.

```
{
  "name": "new name"
}
```

**Response**

```json
{
  "pk": 3,
  "name": "new name"
}
```

### `DELETE` Delete a Permission Group

Path: `/api/v1/groups/{PK}/`

Deletes the record that matches the given PK value in the Group table in the django.contrib.auth.models module included with Django.

**Response**

Response / 204 When a deletion request is completed.

## CatalogGroupViewSet

| **Endpoints**                       |
| ----------------------------------- |
| /api/v1/catalog\_groups/            |
| {\`/api/v1/catalog\_groups/{PK}/\`} |

### `GET` Catalog Groups

Path: `/api/v1/catalog_groups/`

Returns the details of all records in the CatalogGroup table via serializing with the CatalogGroupSerializer class defined at omnitron.users.resources.serializers.

**Successful Response Example**

```json
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 1,
      "group": 1,
      "catalogs": [],
      "modified_date": "2022-12-15T10:30:59.143621Z",
      "created_date": "2022-12-15T10:30:59.143602Z"
    }
  ]
}
```

### `POST` Add Group to a Catalog

Path: `/api/v1/catalog_groups/`

Allows adding new records to the CatalogGroup table. Returns by serializing with the CatalogGroupSerializer class defined at omnitron.users.resources.serializers.

```json
{
  "group": 2,
  "catalogs": [1]
}
```

**Response**

```json
{
  "pk": 2,
  "group": 2,
  "catalogs": [1],
  "modified_date": "2022-12-23T08:58:24.423329Z",
  "created_date": "2022-12-23T08:58:24.423309Z"
}
```

### `DELETE` Delete a Catalog Group

Path: `/api/v1/catalog_groups/`

Deletes the record that matches the given PK value in the CatalogGroup table.

**Response**

Response / 204 When a deletion request is completed.

## ChannelGroupViewSet

| **Endpoints**                       |
| ----------------------------------- |
| /api/v1/channel\_groups/            |
| {\`/api/v1/channel\_groups/{PK}/\`} |

### `GET` Channel Groups

Path: `/api/v1/channel_groups/`

Returns the details of all records in the ChannelGroup table via serializing with the ChannelGroupSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 1,
      "group": 2,
      "channels": [],
      "modified_date": "2022-12-15T10:30:59.145952Z",
      "created_date": "2022-12-15T10:30:59.145937Z"
    }
  ]
}
```

### `POST` Add Group to a Channel

Path: `/api/v1/channel_groups/`

Allows adding new records to the ChannelGroup table. Returns by serializing with the ChannelGroupSerializer class defined at omnitron.users.resources.serializers.

```json
{
  "group": 1,
  "channels": [1]
}
```

**Response**

```json
{
  "pk": 2,
  "group": 1,
  "channels": [1],
  "modified_date": "2022-12-23T09:16:37.793249Z",
  "created_date": "2022-12-23T09:16:37.793228Z"
}
```

### `DELETE` Delete a Catalog Group

Path: `/api/v1/channel_groups/`

Deletes the record that matches the given PK value in the ChannelGroup table.

**Response**

Response / 204 When a deletion request is completed.

## FEPermissionGroupViewSet

| **Endpoints**                                                 |
| ------------------------------------------------------------- |
| /api/v1/fe\_permission\_groups/                               |
| {\`/api/v1/fe\_permission\_groups/{PK}/\`}                    |
| {\`/api/v1/fe\_permission\_groups/{PK}/assign-permissions/\`} |
| {\`/api/v1/fe\_permission\_groups/{PK}/assign-users/\`}       |
| {\`/api/v1/fe\_permission\_groups/{PK}/remove-permissions/\`} |
| {\`/api/v1/fe\_permission\_groups/{PK}/remove-users/\`}       |

### `POST` Create a Permission Group for Omnitron Frontend

Path: `/api/v1/fe_permission_groups/`

Adds records to the FEPermissionGroup table by serializing with the FEPermissionGroupSerializer class defined at omnitron.users.resources.serializers.

```json
{
  "name": "Test",
  "description": null,
  "users": [],
  "fepermissions": []
}
```

**Response**

```json
{
  "pk": 1,
  "name": "Test",
  "description": null,
  "users": [],
  "fepermissions": [],
  "modified_date": "2022-12-23T09:19:51.140162Z",
  "created_date": "2022-12-23T09:19:51.132038Z"
}
```

### `GET` Retrieve Omnitron Frontend Permission Groups

Path: `/api/v1/fe_permission_groups/`

Returns the details of all records in the FEPermissionGroup table via serializing with the FEPermissionGroupSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "pk": 1,
      "name": "Test",
      "description": null,
      "users": [],
      "fepermissions": [],
      "modified_date": "2022-12-23T09:19:51.140162Z",
      "created_date": "2022-12-23T09:19:51.132038Z"
    },
    {
      "pk": 2,
      "name": "Test 1",
      "description": null,
      "users": [],
      "fepermissions": [],
      "modified_date": "2022-12-23T09:22:08.105610Z",
      "created_date": "2022-12-23T09:22:08.104905Z"
    }
  ]
}
```

### `GET` Omnitron Frontend Permission Group

Path: `/api/v1/fe_permission_groups/{PK}`

Returns the details of the record that matches the given PK in the FEPermissionGroup table via serializing with the FEPermissionGroupSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "pk": 1,
  "name": "Test",
  "description": null,
  "users": [],
  "fepermissions": [],
  "modified_date": "2022-12-23T09:19:51.140162Z",
  "created_date": "2022-12-23T09:19:51.132038Z"
}
```

### `PATCH` Add a New User to Omnitron Frontend Permission Group

Path: `/api/v1/fe_permission_groups/{PK}/assign-users/`

Permits the addition of users to a record in the FEPermissionGroup table.

```json
{
  "users": [1, 2, …]
}

```

**Response**

```json
{
  "pk": 1,
  "users": [8, 9]
}
```

### `PATCH` Remove Users from an Omnitron Frontend Permission Group

Path: `/api/v1/fe_permission_groups/{PK}/remove-users/`

Permits the removal of users to a record in the FEPermissionGroup table.

```
{
  "users": [1, 2, …]
}
```

**Response**

```json
{
   "pk": 1,
   "users": [
       8,
       9,
       1,
       2,
       …
   ]
}

```

Following the remove-users request, the relevant record is observed as follows.

```json
{
   "pk": 1,
   "name": "Test",
   "description": null,
   "users": [
       8,
       9
   ],
   "fepermissions": []
   "modified_date": "2022-12-23T09:19:51.140162Z",
   "created_date": "2022-12-23T09:19:51.132038Z"
}
```

### `PATCH` Add an Omnitron Frontend Permission to Omnitron Frontend Permission Group

Path: `/api/v1/fe_permission_groups/{PK}/assign-permissions/`

Permits the addition of an Omnitron Frontend Permission to a record in the FEPermissionGroup table.

```
{
  "fepermissions": [1, 2, …]
}
```

**Response**

```json
{
   "pk": 1,
   "fepermissions": [
       1,
       2,
       …
   ]
}

```

### `PATCH` Remove an Omnitron Frontend Permission from an Omnitron Frontend Permission Group

Path: `/api/v1/fe_permission_groups/{PK}/remove-permissions/`

Permits the removal of users from a record in the FEPermissionGroup table.

```
{
  "fepermissions": [1, 2, …]
}
```

**Response**

```json
{
  "pk": 1,
  "fepermissions": []
}
```

## **FEPermissionViewSet**

| **Endpoints**                                     |
| ------------------------------------------------- |
| /api/v1/fe\_permissions/                          |
| {\`/api/v1/fe\_permissions/{PK}/\`}               |
| {\`/api/v1/fe\_permissions/{PK}/assign-groups/\`} |
| {\`/api/v1/fe\_permissions/{PK}/assign-users/\`}  |
| {\`/api/v1/fe\_permissions/{PK}/remove-groups/\`} |
| {\`/api/v1/fe\_permissions/{PK}/remove-users/\`}  |
| /api/v1/fe\_permissions/detailed\_list/           |

### `GET` Omnitron Frontend Permissions

Path: `/api/v1/fe_permissions/`

Returns by *serializing* all records in the FEPermissions table with the FEPermissionSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
    "count": 514,
    "next": "http://localhost:8000/api/v1/fe_permissions/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 1,
            "name": "is_superuser",
            "slug": "is_superuser",
            "namespace_path": null,
            "path": "",
            "users": [],
            "be_permissions": [],
            "fe_permission_groups": [],
            "depth": 0,
            "modified_date": "2021-08-25T09:22:57.546000Z",
            "created_date": "2021-08-25T09:22:57.546000Z"
        }
    ],
    …
}
```

### `GET` Omnitron Frontend Permission

Path: `/api/v1/fe_permissions/{PK}/`

Returns by *serializing* requested records matching the given PK in the FEPermission table with the FEPermissionSerializer class defined at omnitron.users.resources.serializers.

**Response**

```json
{
  "pk": 1,
  "name": "is_superuser",
  "slug": "is_superuser",
  "namespace_path": null,
  "path": "",
  "users": [],
  "be_permissions": [],
  "fe_permission_groups": [],
  "depth": 0,
  "modified_date": "2021-08-25T09:22:57.546000Z",
  "created_date": "2021-08-25T09:22:57.546000Z"
}
```

### `PATCH` Assign Users to an Omnitron Frontend Permission

Path: `/api/v1/fe_permission/{PK}/assign-users/`

Assigns given users to the record matching the given PK in the FEPermission table.

```
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
    "pk": 1,
    "users": [
        1,
        2,
        …
    ]
}
```

### `PATCH` Remove Users from a User Permission

Path: `/api/v1/fe_permission/{PK}/remove-users/`

Removes given users from the record matching the given PK in the FEPermission table.

```
{
    "users": [1, 2, ...]
}
```

**Response**

```json
{
    "pk": 1
    "users": []
}
```

### `PATCH` Assign Omnitron Frontend Permission Groups to an Omnitron Frontend Permission

Path: `/api/v1/fe_permission/{PK}/assign-groups/`

Assigns given FEPermissionGroups to the record matching the given PK in the FEPermission table.

```
{
    "fe_permission_groups": [1, 2, ...]
}
```

**Response**

```json
{
    "pk": 1,
    "fe_permission_groups": [
        1,
        2,
        …
    ]
}
```

### `PATCH` Remove Users from a User Permission

Path: `/api/v1/fe_permission/{PK}/remove-groups/`

Removes given FEPermissionGroups from the record matching the given PK in the FEPermission table.

```
{
    "fe_permission_groups": [1, 2, ...]
}
```

**Response**

```json
{
    "pk": 1
    "fe_permission_groups": []
}
```


# Whippy Ware


# Introduction

Whippy Ware offers a structure that can store stock information based on SKUs, regularly set stock levels via stock lists and provides the ability to store and manage stock information based on specific locations.

The following diagram depicts the Whippy Ware modules along with their connections between these modules.

## API Authentication for Whippy Ware

Authentication is required for all requests to Akinon's REST API. In order to start using the Akinon APIs, you need to generate an API key using the **Login API**. Subsequently, all other requests should be sent with the token obtained from the login response.

The responses from Akinon's API are formatted in JSON. The API is served over HTTPS to ensure data privacy, and unencrypted HTTP requests are not supported.

The authentication endpoints in Whippy Ware are responsible for user authentication and authorization processes within the application. Whippy Ware utilizes the **Omnitron Authentication** method, which allows the authentication information of Omnitron users to be used for authentication within the Whippy Ware system.

### Allowed HTTPs Requests

Authentication endpoints are only accepts `POST` requests.

### Potential Responses

The following status codes returns in the response message body of the request.

* **200 OK:** The request was successful and the requested resource is returned in the response.
* **201 Created:** The request was successful and the requested resource is created.
* **204 No Content:** The request was successful and there is no content to be returned.
* **400 Bad Request:** The request was malformed or missing, false given required parameters.
* **401 Unauthorized:** The requested user is not authorized to access the requested resource.

## Creating Token

This method is used to creating a token with given user and password data.

### `POST` **Creating-Token**

**Path:** `/api/v1/auth/login/`

#### Parameters

|  Parameter | Data Type |   In   |             Description             |
| :--------: | :-------: | :----: | :---------------------------------: |
| api\_token |   string  | header | The API key of the customer account |

#### Example Request

```python
{
	"username": "test",
	"password": "test_pass"
}
```

#### Example Response (200 OK)

```json
{
	"key": "XXXa0590XXXXXX05f7f9265XXXXXXXXX548bXXXX"
	Authentication 1
}
```

#### Example Response (400 Bad Request)

```json
HTTP 400
{
	"username": [
	"This field is required."
	],
	"password": [
	"This field is required."
	]
}
```

## Removing Token

This method is used to remove the token object regarding the user in the request body.

### `POST` **Removing-Token**

**Path:** `/api/v1/expire-token/`

#### Parameters

|  Parameter | Data Type |   In   |             Description             |
| :--------: | :-------: | :----: | :---------------------------------: |
| api\_token |   string  | header | The API key of the customer account |

#### Example Request

```python
{
	"username": "test"
}
```

#### Example Response (204 No Content)

```json
No Content
```

#### Example Request

```python
{
	"email": "test@test.com",
}
```

#### Example Response (400 Bad Request)

```json
HTTP 400
{
	"username": [
	"This field is required."
	]
}
```


# Stock

The stocks are fetched from the brand through integration, utilizing SKUs, locations, and stock providers. The stock object contains details about the quantity of reserved stocks for a specific SKU in the corresponding location. These reserved stocks are allocated for orders that have not yet been sent to the ERP or transitioned to the "Preparing" status.

### List Stock​ <a href="#list-stock" id="list-stock"></a>

This method is used to get a list of stock objects.

`GET` **List-Stock**

**Path:** `/api/v1/stocks/`

**Parameters​**

The following parameters can be used to get a list of stock objects.

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| limit      | integer   | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request​**

```
import requests

url = "http://localhost:8000/api/v1/stocks/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter       | Data Type | Description                        |
| --------------- | --------- | ---------------------------------- |
| id              | integer   | The primary key of the stock       |
| sku             | string    | The SKU of the product             |
| provider        | string    | The name of the provider           |
| location        | integer   | The stock location ID              |
| stock           | integer   | The number of existing stocks      |
| period          | date      | The stock period                   |
| unittype        | string    | The type of the stock unit         |
| stock\_type     | string    | The type of the stock              |
| reserved\_stock | integer   | Reserved stock count               |
| created\_date   | date      | The creation date                  |
| modified\_date  | date      | The last modified date             |
| is\_active      | boolean   | The activation status of the stock |

```
{
   "count": 3,
   "next": null,
   "previous": null,
   "results": [
       {
           "id": 2,
           "created_date": "2023-05-10T13:37:18.209869+03:00",
           "modified_date": "2023-05-10T13:37:18.210018+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213002",
           "reserved_stock": 0
       },
       {
           "id": 4,
           "created_date": "2023-05-10T15:14:40.733472+03:00",
           "modified_date": "2023-05-10T15:14:40.733504+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213003",
           "reserved_stock": 0
       },
       {
           "id": 6,
           "created_date": "2023-05-10T15:15:03.254957+03:00",
           "modified_date": "2023-05-10T15:15:03.254980+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213004",
           "reserved_stock": 0
       }
   ]
}
```

### Create Stock​ <a href="#create-stock" id="create-stock"></a>

This method is used to create a stock object with the request body.

`POST` **Create-Stock**

**Path:** `/api/v1/stocks/`

**Parameters​**

The following parameters can be used to create a stock object.

| Parameter  | Data Type | In     | Required | Description                                       |
| ---------- | --------- | ------ | :------: | ------------------------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account               |
| sku        | string    | body   |     ✓    | The SKU of the product                            |
| provider   | string    | body   |     ✓    | The name of the provider                          |
| location   | string    | body   |     ✓    | The stock location                                |
| stock      | integer   | body   |     ✓    | The number of the existing stock for this product |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 "period": None,
 "stock_type": "standard",
 "unit_type": "qty",
 "provider": "shop_provider",
 "location": "110",
 "stock": 5,
 "is_active": True,
 "sku": "555AB1300456213004",
 "reserved_stock": 0
})
headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)​**

The response includes the following parameters.

| Parameter       | Data Type | Description                        |
| --------------- | --------- | ---------------------------------- |
| id              | integer   | The primary key of the stock       |
| sku             | string    | The SKU of the product             |
| provider        | string    | The name of the provider           |
| location        | integer   | The stock location ID              |
| stock           | integer   | The number of existing stocks      |
| period          | date      | The stock period                   |
| unittype        | string    | The type of the stock unit         |
| stock\_type     | string    | The type of the stock              |
| reserved\_stock | integer   | Reserved stock count               |
| created\_date   | date      | The creation date                  |
| modified\_date  | date      | The last modified date             |
| is\_active      | boolean   | The activation status of the stock |

```
{
   "id": 6,
   "created_date": "2023-05-10T15:15:03.254957+03:00",
   "modified_date": "2023-05-10T15:15:03.254980+03:00",
   "period": null,
   "stock_type": "standard",
   "unit_type": "qty",
   "provider": "shop_provider",
   "location": "110",
   "stock": 5,
   "is_active": true,
   "sku": "555AB1300456213004",
   "reserved_stock": 0
}
```

**Example Response (400 Bad Request)​**

```
{
   "stock_exists_error": "Stock already exists."
}
—-------
{
   "provider": [
       "This field is required."
   ],
   "location": [
       "This field is required."
   ],
   "stock": [
       "This field is required."
   ],
   "sku": [
       "This field is required."
   ]
}
---
{
   "invalid_location": "Location does not belong to provider."
}
```

### Search Stocks​ <a href="#search-stocks" id="search-stocks"></a>

This method is used to search stock objects with the specified filters.

`GET` **Search-Stocks**

**Path:** `/api/v1/stocks/?sku=&lt;string>&stock__gt=&lt;number>&stock__gte=&lt;number>&stock__lt=&lt;number>&stock__lte=&lt;number>&stock=&lt;number>&reserved_stock__gt=&lt;number>&reserved_stock__gte=&lt;number>&reserved_stock__lt=&lt;number>&reserved_stock__lte=&lt;number>&reserved_stock=&lt;number>&created_date__gt=&lt;string>&created_date__gte=&lt;string>&created_date__lt=&lt;string>&created_date__lte=&lt;string>&created_date=&lt;string>&modified_date__gt=&lt;string>&modified_date__gte=&lt;string>&modified_date__lt=&lt;string>&modified_date__lte=&lt;string>&modified_date=&lt;string>&is_active=&lt;string>&location=&lt;string>&provider=&lt;string>&location_name=&lt;string>&provider_name=&lt;string>&period=&lt;string>&unit_type=&lt;string>&stock_type=&lt;string>&sort=&lt;string>&page=&lt;integer>&limit=&lt;integer>`

**Filters​**

The following parameters can be used to filter GET request results.

| Parameter            | Data Type | In     | Description                         |
| -------------------- | --------- | ------ | ----------------------------------- |
| api\_token           | string    | header | The API key of the customer account |
| location             | string    | query  | The code of the stock location      |
| location\_name       | string    | query  | The name of the stock location      |
| provider             | string    | query  | The stock provider ID               |
| provider\_name       | string    | query  | The name of the provider            |
| is\_active           | boolean   | query  | The activation status of the stock  |
| created\_date        | date      | query  | The creation date                   |
| modified\_date       | date      | query  | The last modified date              |
| modified\_date\_\_gt | date      | query  | After that date                     |
| unit\_type           | string    | query  | "quantity", "kilogram"              |
| stock\_type          | string    | query  | "standard", "scheduled"             |
| stock\_\_gt          | integer   | query  | Minimum stock count                 |

The following filters can be applied via the request URL.

```
"filters": {
       "sku": {
           "type": "CharFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "stock": {
           "type": "NumberFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "reserved_stock": {
           "type": "NumberFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "created_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "modified_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "is_active": {
           "type": "BooleanFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "period": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "startswith__gte",
               "startswith__lte",
               "endswith__gte",
               "endswith__lte"
           ]
       },
       "location": {
           "type": "CharFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "provider": {
           "type": "CharFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "location_name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       },
       "provider_name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       },
       "unit_type": {
           "type": "ChoiceFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "stock_type": {
           "type": "ChoiceFilter",
           "lookup_types": [
               "exact"
           ]
       }
   }
```

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/stocks/?sku=<string>&stock__gt=<number>&stock__gte=<number>&stock__lt=<number>&stock__lte=<number>&stock=<number>&reserved_stock__gt=<number>&reserved_stock__gte=<number>&reserved_stock__lt=<number>&reserved_stock__lte=<number>&reserved_stock=<number>&created_date__gt=<string>&created_date__gte=<string>&created_date__lt=<string>&created_date__lte=<string>&created_date=<string>&modified_date__gt=<string>&modified_date__gte=<string>&modified_date__lt=<string>&modified_date__lte=<string>&modified_date=<string>&is_active=<string>&location=<string>&provider=<string>&location_name=<string>&provider_name=<string>&period=<string>&unit_type=<string>&stock_type=<string>&sort=<string>&page=<integer>&limit=<integer>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter       | Data Type | Description                        |
| --------------- | --------- | ---------------------------------- |
| id              | integer   | The primary key of the stock       |
| sku             | string    | The SKU of the product             |
| provider        | string    | The name of the provider           |
| location        | integer   | The stock location ID              |
| stock           | integer   | The number of existing stocks      |
| period          | date      | The stock period                   |
| unittype        | string    | The type of the stock unit         |
| stock\_type     | string    | The type of the stock              |
| reserved\_stock | integer   | Reserved stock count               |
| created\_date   | date      | The creation date                  |
| modified\_date  | date      | The last modified date             |
| is\_active      | boolean   | The activation status of the stock |

```
{
   "count": 3,
   "next": null,
   "previous": null,
   "results": [
       {
           "id": 2,
           "created_date": "2023-05-10T13:37:18.209869+03:00",
           "modified_date": "2023-05-10T13:37:18.210018+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213002",
           "reserved_stock": 0
       },
       {
           "id": 4,
           "created_date": "2023-05-10T15:14:40.733472+03:00",
           "modified_date": "2023-05-10T15:14:40.733504+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213003",
           "reserved_stock": 0
       },
       {
           "id": 6,
           "created_date": "2023-05-10T15:15:03.254957+03:00",
           "modified_date": "2023-05-10T15:15:03.254980+03:00",
           "period": null,
           "stock_type": "standard",
           "unit_type": "qty",
           "provider": "shop_provider",
           "location": "110",
           "stock": 5,
           "is_active": true,
           "sku": "555AB1300456213004",
           "reserved_stock": 0
       }
   ]
}
```

### Increase Reserved Stock​ <a href="#increase-reserved-stock" id="increase-reserved-stock"></a>

This method is used to increase the reserved stock for the specified SKU, location and provider.

`POST` **Increase-Reserved-Stock**

**Path:** `/api/v1/stocks/increase_reserved_stock/`

**Parameters​**

The following parameters can be used to increase reserved stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |
| location   | string    | query  |     ✓    | The ID of the location              |
| provider   | string    | query  |          | The ID of the provider              |
| date       | date      | query  |          | The creation date of the stock      |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/increase_reserved_stock/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 "sku": "555AB1300456213004",
 "location": "110"
})
headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)​**

The response includes the following parameters.

| Parameter       | Data Type | Description                        |
| --------------- | --------- | ---------------------------------- |
| id              | integer   | The primary key of the stock       |
| sku             | string    | The SKU of the product             |
| provider        | string    | The name of the provider           |
| location        | integer   | The stock location ID              |
| stock           | integer   | The number of existing stocks      |
| period          | date      | The stock period                   |
| unittype        | string    | The type of the stock unit         |
| stock\_type     | string    | The type of the stock              |
| reserved\_stock | integer   | Reserved stock count               |
| created\_date   | date      | The creation date                  |
| modified\_date  | date      | The last modified date             |
| is\_active      | boolean   | The activation status of the stock |

```
{
   "id": 6,
   "created_date": "2023-05-10T15:15:03.254957+03:00",
   "modified_date": "2023-05-10T17:16:02.653646+03:00",
   "period": null,
   "stock_type": "standard",
   "unit_type": "qty",
   "provider": "shop_provider",
   "location": "110",
   "stock": 5,
   "is_active": true,
   "sku": "555AB1300456213004",
   "reserved_stock": 1
}
```

**Example Response (400 Bad Request - 208 Already Reported)​**

```
HTTP 400
{
   "sku": [
       "This field is required."
   ],
   "location": [
       "This field is required."
   ]
}

HTTP 208
{
   "message": "Already reported"
}
```

### Decrease Reserved Stock​ <a href="#decrease-reserved-stock" id="decrease-reserved-stock"></a>

This method is used to decrease the reserved stock for the specified SKU, location and provider.

`POST` **Decrease-Reserved-Stock**

**Path:** `/api/v1/stocks/decrease_reserved_stock/`

**Parameters​**

The following parameters can be used to decrease reserved stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |
| location   | string    | query  |     ✓    | The ID of the location              |
| provider   | string    | query  |          | The ID of the provider              |
| date       | date      | query  |          | The creation date of the stock      |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/decrease_reserved_stock/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 "sku": "555AB1300456213004",
 "location": "110"
})
headers = {
 'Content-Type': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)​**

The response includes the following parameters.

| Parameter       | Data Type | Description                           |
| --------------- | --------- | ------------------------------------- |
| id              | integer   | The primary key of the stock location |
| sku             | string    | The SKU of the product                |
| provider        | string    | The name of the provider              |
| location        | integer   | The stock location ID                 |
| stock           | integer   | The number of existing stocks         |
| period          | date      | The stock period                      |
| unittype        | string    | The type of the stock unit            |
| stock\_type     | string    | The type of the stock                 |
| reserved\_stock | integer   | Reserved stock count                  |
| created\_date   | date      | The creation date                     |
| modified\_date  | date      | The last modified date                |
| is\_active      | boolean   | The activation status of the stock    |

```
{
   "id": 6,
   "created_date": "2023-05-10T15:15:03.254957+03:00",
   "modified_date": "2023-05-10T17:55:05.904288+03:00",
   "period": null,
   "stock_type": "standard",
   "unit_type": "qty",
   "provider": "shop_provider",
   "location": "110",
   "stock": 3,
   "is_active": true,
   "sku": "555AB1300456213004",
   "reserved_stock": 10
}
```

**Example Response (400 Bad Request - 208 Already Reported)​**

```
HTTP 400
{
   "sku": [
       "This field is required."
   ],
   "location": [
       "This field is required."
   ]
}

HTTP 208
{
   "message": "Already reported"
}
```

### Stock Query​ <a href="#stock-query" id="stock-query"></a>

This method is used to query stock.

`GET` **Stock-Query**

**Path:** `/api/v1/stocks/stock_query/`

**Parameters​**

The following parameters can be used to query stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/stock_query/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 'sku': '500'
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter           | Data Type | Description                      |
| ------------------- | --------- | -------------------------------- |
| sku                 | string    | The SKU of the product           |
| retail\_store\_code | string    | The code of the retail store     |
| retail\_store\_name | string    | The name of the retail store     |
| stock               | integer   | The number of the existing stock |

```
{ 
"Store_checkResult": [ 
  { 
   "sku": "500", 
   "retail_store_code": "110", 
   "retail_store_name": "110", 
   "stock": 5 
  }, 
  { 
   "sku": "500", 
   "retail_store_code": "112", 
   "retail_store_name": "112", 
   "stock": 5 
  }, 
  { 
   "sku": "500", 
   "retail_store_code": "115", 
   "retail_store_name": "115", 
   "stock": 5 
  }, 
  { 
   "sku": "500", 
   "retail_store_code": "117", 
   "retail_store_name": "117", 
   "stock": 5 
  }, 
  { 
   "sku": "500", 
   "retail_store_code": "119", 
   "retail_store_name": "119", 
   "stock": 5 
  } 
 ] 
}
```

### Multi Stock Query​ <a href="#multi-stock-query" id="multi-stock-query"></a>

This method is used to query multiple stock.

`GET` **Multi-Stock-Query**

**Path:** `/api/v1/stocks/multi_stock_query/`

**Parameters​**

The following parameters can be used to query multiple stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/multi_stock_query/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 'sku': ['500','505']
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/multi_stock_query/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 'sku': ['500','505']
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter           | Data Type | Description                      |
| ------------------- | --------- | -------------------------------- |
| sku                 | string    | The SKU of the product           |
| retail\_store\_code | string    | The code of the retail store     |
| retail\_store\_name | string    | The name of the retail store     |
| stock               | integer   | The number of the existing stock |

```
{ 
  "Store_checkResult": { 
    "500": [ 
      { 
        "sku": "500", 
        "retail_store_code": "110", 
        "retail_store_name": "110", 
        "stock": 5 
      }, 
      { 
        "sku": "500", 
        "retail_store_code": "112", 
        "retail_store_name": "112", 
        "stock": 5 
      }, 
      { 
        "sku": "500", 
        "retail_store_code": "117", 
        "retail_store_name": "117", 
        "stock": 5 
      } 
    ], 
  "505": [ 
      { 
        "sku": "505", 
        "retail_store_code": "110", 
        "retail_store_name": "110", 
        "stock": 3 
      }, 
      { 
        "sku": "505", 
        "retail_store_code": "112", 
        "retail_store_name": "112", 
        "stock": 3 
      }, 
      { 
        "sku": "505", 
        "retail_store_code": "115", 
        "retail_store_name": "115", 
        "stock": 3 
      } 
}  ] 
} 
```

### Multi Salable Stock Query​ <a href="#multi-salable-stock-query" id="multi-salable-stock-query"></a>

This method is used to query multiple salable stock.

`GET` **Multi-Salable Stock-Query**

**Path:** `/api/v1/stocks/multi_salable_stock_query/`

**Parameters​**

The following parameters can be used to query multiple salable stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/multi_salable_stock_query/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 'sku': ['500','505']
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter           | Data Type | Description                      |
| ------------------- | --------- | -------------------------------- |
| sku                 | string    | The SKU of the product           |
| retail\_store\_code | string    | The code of the retail store     |
| retail\_store\_name | string    | The name of the retail store     |
| stock               | integer   | The number of the existing stock |

```
{ 
  "Store_checkResult": { 
    "500": [ 
      { 
        "sku": "500", 
        "retail_store_code": "110", 
        "retail_store_name": "110", 
        "stock": 5 
      }, 
      { 
        "sku": "500", 
        "retail_store_code": "112", 
        "retail_store_name": "112", 
        "stock": 5 
      }, 
      { 
        "sku": "500", 
        "retail_store_code": "117", 
        "retail_store_name": "117", 
        "stock": 5 
      } 
    ], 
    "505": [ 
      { 
        "sku": "505", 
        "retail_store_code": "110", 
        "retail_store_name": "110", 
        "stock": 3 
      }, 
      { 
        "sku": "505", 
        "retail_store_code": "112", 
        "retail_store_name": "112", 
        "stock": 3 
      }, 
      { 
        "sku": "505", 
        "retail_store_code": "115", 
        "retail_store_name": "115", 
        "stock": 3 
      } 
    ] 
  } 
}
```

### Salable Stock Query​ <a href="#salable-stock-query" id="salable-stock-query"></a>

This method is used to query salable stock.

`GET` **Salable Stock-Query**

**Path:** `api/v1/stocks/salable_stock_query/`

**Parameters​**

The following parameters can be used to query salable stock.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| sku        | string    | query  |     ✓    | The SKU of the product              |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/salable_stock_query/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 'sku': '500'
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter           | Data Type | Description                      |
| ------------------- | --------- | -------------------------------- |
| sku                 | string    | The SKU of the product           |
| retail\_store\_code | string    | The code of the retail store     |
| retail\_store\_name | string    | The name of the retail store     |
| stock               | integer   | The number of the existing stock |

```
{ 
  "Store_checkResult": [ 
    { 
      "sku": "500", 
      "retail_store_code": "110", 
      "retail_store_name": "110", 
      "stock": 5 
    }, 
    { 
      "sku": "500", 
      "retail_store_code": "112", 
      "retail_store_name": "112", 
      "stock": 5 
    }, 
    { 
      "sku": "500", 
      "retail_store_code": "115", 
      "retail_store_name": "115", 
      "stock": 5 
    }, 
    { 
      "sku": "500", 
      "retail_store_code": "117", 
      "retail_store_name": "117", 
      "stock": 5 
    }, 
    { 
      "sku": "500", 
      "retail_store_code": "119", 
      "retail_store_name": "119", 
      "stock": 5 
    } 
  ] 
}
```

### Insert/Update Single/Multiple Stock​ <a href="#insertupdate-singlemultiple-stock" id="insertupdate-singlemultiple-stock"></a>

This method is used to upsert single or multiple stock.

`POST` **Single-or-Multiple-Stock-Upsert**

**Path:** `/api/v1/stocks/insert_or_update_stock/`

**Parameters​**

The following parameters can be used to upsert single or multiple stock.

| Parameter  | Data Type | In     | Required | Description                                       |
| ---------- | --------- | ------ | :------: | ------------------------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account               |
| sku        | string    | body   |     ✓    | The SKU of the product                            |
| provider   | string    | body   |     ✓    | The name of the provider                          |
| location   | string    | body   |     ✓    | The stock location                                |
| stock      | integer   | body   |     ✓    | The number of the existing stock for this product |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stocks/insert_or_update_stock/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps([
{
    "provider": "shop_provider",
    "location": "stock_loc_1",
    "stock": 5,
    "sku": "500"
},
{
    "provider": "shop_provider",
    "location": "stock_loc_1",
    "stock": 5,
    "sku": "520"
},
{
    "provider": "shop_provider",
    "location": "stock_loc_1",
    "stock": 5,
    "sku": "540"
},
{
    "provider": "shop_provider",
    "location": "stock_loc_1",
    "stock": 5,
    "sku": "560"
])

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

```
{ 
    "Store_checkResult": {} 
}
```

### List Active Stock​ <a href="#list-active-stock" id="list-active-stock"></a>

This methods are used to get a list of single or multiple active stock.

#### List Single Active Stock​ <a href="#list-single-active-stock" id="list-single-active-stock"></a>

This methods are used to get a list of single active stock.

`GET` **List-Single-Active-Stock**

**Path:** `/api/v1/active-stocks/{stocklist_id}/`

**Parameters​**

The following parameters can be used to get a list of single active stock.

| Parameter       | Data Type | In          | Required | Description                                                                    |
| --------------- | --------- | ----------- | :------: | ------------------------------------------------------------------------------ |
| api\_token      | string    | header      |     ✓    | The API key of the customer account                                            |
| {stocklist\_id} | string    | query       |     ✓    | The ID of the stock list (also referred to as the stock list code in Omnitron) |
| sku             | string    | query param |     ✓    | The SKU of the product                                                         |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/active-stocks/{stocklist_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 "sku": "500"
})

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter | Data Type | Description                      |
| --------- | --------- | -------------------------------- |
| sku       | string    | The SKU of the product           |
| stock     | integer   | The number of the existing stock |

```
{ 
    "next": "https://{whippy_api_url}/api/v1/active-stocks/1/?page=2",
    "previous": null, 
    "results": [ 
        { 
            "sku": "100", 
            "stock": 5, 
            "extra_field": {
                "locations": null
            }
        }, 
        { 
            "sku": "300", 
            "stock": 5,
            "extra_field": {
                "locations": null
            }
        }, 
        { 
            "sku": "500", 
            "stock": 5,
            "extra_field": {
                "locations": null
            } 
         } 
    ] 
}
```

#### List Multiple Active Stock​ <a href="#list-multiple-active-stock" id="list-multiple-active-stock"></a>

This methods are used to get a list of multiple active stock.

`POST` **List-Multiple-Active-Stock**

**Path:** `/api/v1/stocks/{stocklist_id}/`

**Parameters​**

The following parameters can be used to get a list of multiple active stock.

| Parameter       | Data Type | In     | Required | Description                                                                    |
| --------------- | --------- | ------ | :------: | ------------------------------------------------------------------------------ |
| api\_token      | string    | header |     ✓    | The API key of the customer account                                            |
| {stocklist\_id} | string    | query  |     ✓    | The ID of the stock list (also referred to as the stock list code in Omnitron) |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/active-stocks/{stocklist_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("POST", url, headers=headers)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter | Data Type | Description                      |
| --------- | --------- | -------------------------------- |
| sku       | string    | The SKU of the product           |
| stock     | integer   | The number of the existing stock |

```
{ 
    "next": "https://{whippy_api_url}/api/v1/active-stocks/1/?page=2",
    "previous": null, 
    "results": [ 
        { 
            "sku": "100", 
            "stock": 5, 
        }, 
        { 
            "sku": "300", 
            "stock": 5, 
        }, 
        { 
            "sku": "500", 
            "stock": 5, 
         } 
    ] 
}
```


# Stock Lists

Stock Lists enable the mapping between a predefined stock list ID in Omnitron and the corresponding rule to be applied to that stock list. This association allows the utilization of rule sets created in Omnitron and OMS (Order Management System).

### List Stock Lists

This method is used to get a list of stock list objects.

`GET` **List-Stock-Lists**

**Path:** `/api/v1/stock-lists/`

**Parameters**

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| limit      | string    | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request**

```python
import requests

url = "http://localhost:8000/api/v1/stock-lists/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
```

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter         | Data Type | Description                       |
| ----------------- | --------- | --------------------------------- |
| id                | integer   | The primary key of the stock list |
| name              | string    | The name of the list              |
| code              | integer   | The code of the stock list        |
| remote\_id        | integer   | The remote ID                     |
| stock\_list\_rule | string    | The rule of the stock list        |
| created\_date     | date      | The creation date                 |
| modified\_date    | date      | The last modified date            |
| is\_active        | boolean   | The activation status of the rule |

```json
{
	"count": 3,
	"next": "https://{whippy_api_url}/api/v1/stock-lists/?page=2",
	"previous": null,
	"results": [
    	{
        	"id": 1,
        	"created_date": "2023-05-09T14:42:44.507114+03:00",
        	"modified_date": "2023-05-09T14:54:38.997168+03:00",
        	"is_active": true,
        	"code": "alpha_stock_list",
        	"name": "Alpha Stock List",
        	"remote_id": 1,
        	"stock_list_rule": 1
    	},
    	{
        	"id": 2,
        	"created_date": "2023-05-09T14:44:25.500852+03:00",
        	"modified_date": "2023-05-09T14:54:41.981423+03:00",
        	"is_active": true,
        	"code": "marketplace_stock_list",
        	"name": "Marketplace Stock List",
        	"remote_id": 2,
        	"stock_list_rule": 1
    	},
    	{
        	"id": 3,
        	"created_date": "2023-05-09T14:46:44.973248+03:00",
        	"modified_date": "2023-05-09T14:54:45.502269+03:00",
        	"is_active": true,
        	"code": "warehouse_stock_list",
        	"name": "Warehouse Stock List",
        	"remote_id": 3,
        	"stock_list_rule": 1
    	}
	]
}
```

### Stock List Instance

This method is used to get a list of stock instance.

`GET` **Stock-List-Instance**

**Path:** `/api/v1/stock-lists/{stocklist_id}/`

**Parameters**

| Parameter       | Data Type | In     | Description                                                                    |
| --------------- | --------- | ------ | ------------------------------------------------------------------------------ |
| api\_token      | string    | header | The API key of the customer account                                            |
| {stocklist\_id} | string    | query  | The ID of the stock list (also referred to as the stock list code in Omnitron) |

**Example Request**

```python
import requests

url = "http://localhost:8000/api/v1/stock-lists/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter         | Data Type | Description                       |
| ----------------- | --------- | --------------------------------- |
| id                | integer   | The primary key of the stock list |
| name              | string    | The name of the list              |
| code              | integer   | The code of the stock list        |
| remote\_id        | integer   | The remote ID                     |
| stock\_list\_rule | string    | The rule of the stock list        |
| created\_date     | date      | The creation date                 |
| modified\_date    | date      | The last modified date            |
| is\_active        | boolean   | The activation status of the rule |

```json
{
	"id": 1,
	"created_date": "2023-05-09T14:42:44.507114+03:00",
	"modified_date": "2023-05-09T14:54:38.997168+03:00",
	"is_active": true,
	"code": "alpha_stock_list",
	"name": "Alpha Stock List",
	"remote_id": 1,
	"stock_list_rule": 1
}
```

### Create Stock List

This method is used to create a new stock list object.

`POST` **Create-Stock-List**

**Path:** `/api/v1/stock-lists/`

**Parameters**

| Parameter         | Data Type | In     | Required | Description                         |
| ----------------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token        | string    | header |     ✓    | The API key of the customer account |
| code              | string    | body   |     ✓    | The code of the stock list          |
| name              | string    | body   |     ✓    | The name of the stock list          |
| remote\_id        | integer   | body   |     ✓    | The remote ID                       |
| stock\_list\_rule | integer   | body   |     ✓    | The rule of the stock list          |

**Example Request**

```python
import requests
import json

url = "https://{whippy_api_url}/api/v1/stock-lists/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "code": "new_stock_list",
  "name": "Shop New Stock List",
  "remote_id": 5,
  "stock_list_rule": 1,
  "is_active": True
})
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)**

The response includes the following parameters.

| Parameter         | Data Type | Description                               |
| ----------------- | --------- | ----------------------------------------- |
| id                | string    | The primary key of the created stock list |
| name              | string    | The name of the rule                      |
| code              | string    | The code of the stock list                |
| remote\_id        | integer   | The remote ID                             |
| stock\_list\_rule | integer   | The rule of the stock list                |
| created\_date     | date      | The creation date                         |
| modified\_date    | date      | The last modified date                    |
| is\_active        | boolean   | The activation status of the rule         |

```json
{
	"id": 4,
	"created_date": "2023-05-10T09:16:42.009484+03:00",
	"modified_date": "2023-05-10T09:16:42.009517+03:00",
	"is_active": true,
	"code": "new_stock_list",
	"name": "Shop New Stock List",
	"remote_id": 5,
	"stock_list_rule": 1
}
```

**Example Response (400 Bad Request)**

```json
{
   "code": [
       "This field is required."
   ],
   "name": [
       "This field is required."
   ],
   "remote_id": [
       "This field is required."
   ],
   "stock_list_rule": [
       "This field is required."
   ]
}
```

### Search Stock Lists

This method is used to search stock list object with the specified filters.

`GET` **Search-Stock-List**

**Path:** `stock-lists/?name=&lt;string>&is_active=&lt;string>&remote_id=&lt;number>&code=&lt;string>&code__contains=&lt;string>&created_date__gt=&lt;string>&created_date__gte=&lt;string>&created_date__lt=&lt;string>&created_date__lte=&lt;string>&created_date=&lt;string>&modified_date__gt=&lt;string>&modified_date__gte=&lt;string>&modified_date__lt=&lt;string>&modified_date__lte=&lt;string>&modified_date=&lt;string>&rule_name=&lt;string>&sort=&lt;string>&page=&lt;integer>&limit=&lt;integer>`

**Filters**

The following parameters can be used to filter GET request results.

| Parameter      | Data Type | In     | Description                                |
| -------------- | --------- | ------ | ------------------------------------------ |
| api\_token     | string    | header | The API key of the customer account        |
| name           | string    | query  | The name of the rule                       |
| code           | string    | query  | The code of the stock                      |
| remote\_id     | string    | query  | The remote ID                              |
| created\_date  | date      | query  | The creation date                          |
| modified\_date | date      | query  | The last modified date                     |
| is\_active     | boolean   | query  | The activation status of the rule          |
| limit          | string    | query  | The amount of line items returned per page |
| page           | integer   | query  | The number of page returned                |

**Example Request**

```python
import requests

url = "https://{whippy_api_url}/api/v1/stock-lists/?remote_id=4"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter         | Data Type | Description                         |
| ----------------- | --------- | ----------------------------------- |
| id                | string    | The primary key of the created list |
| name              | string    | The name of the rule                |
| code              | string    | The code of the stock list          |
| remote\_id        | integer   | The remote ID                       |
| stock\_list\_rule | integer   | The rule of the stock list          |
| created\_date     | date      | The creation date                   |
| modified\_date    | date      | The last modified date              |
| is\_active        | boolean   | The activation status of the rule   |

```json
{
	"count": 1,
	"next": "https://{whippy_api_url}/api/v1/stock-lists/?page=2&remote_id=1",
	"previous": null,
	"results": [
    	{
        	"id": 1,
        	"created_date": "2023-05-09T14:42:44.507114+03:00",
        	"modified_date": "2023-05-09T17:44:28.736384+03:00",
        	"is_active": true,
        	"code": "alpha_stock_list",
        	"name": "Alpha Stock List",
        	"remote_id": 4,
        	"stock_list_rule": 1
    	}
	]
}
```

### Stock List Partial Update

This method is used to partially update the specified stock list object with PATCH request.

`PATCH` **Stock-List-Partial-Update**

**Path:** `/api/v1/stock-lists/{stocklist_id}/`

**Parameters**

| Parameter       | Data Type | In     | Description                                                                    |
| --------------- | --------- | ------ | ------------------------------------------------------------------------------ |
| api\_token      | string    | header | The API key of the customer account                                            |
| {stocklist\_id} | string    | query  | The ID of the stock list (also referred to as the stock list code in Omnitron) |

**Example Request**

```python
import requests
import json
url = "http://localhost:8000/api/v1/stock-lists/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "remote_id": 4
})
headers = {
  'Content-Type': 'application/json'
  'Authorization': 'Token {}'.format(api_token)
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
```

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter         | Data Type | Description                       |
| ----------------- | --------- | --------------------------------- |
| id                | integer   | The primary key of the stock list |
| name              | string    | The name of the stock list        |
| code              | integer   | The code of the stock list        |
| remote\_id        | integer   | The remote ID                     |
| stock\_list\_rule | integer   | The ID of the stock list rule     |
| created\_date     | date      | The creation date                 |
| modified\_date    | date      | The last modified date            |
| is\_active        | boolean   | The activation status of the rule |

```json
{
	"id": 1,
	"created_date": "2023-05-09T14:42:44.507114+03:00",
	"modified_date": "2023-05-09T17:28:05.664177+03:00",
	"is_active": true,
	"code": "alpha_stock_list",
	"name": "Alpha Stock List",
	"remote_id": 4,
	"stock_list_rule": 1
}
```

### Stock List Full Update

This method is used to update all fields of the specified stock list object with PUT request.

`PUT` **Stock-List**

**Path:** `/api/v1/stock-lists/{stocklist_id}/`

**Example Request**

```python
import requests
import json

url = "http://localhost:8000/api/v1/stock-lists/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "is_active": True,
  "code": "alpha_stock_list",
  "name": "Alpha Stock List",
  "remote_id": 4,
  "stock_list_rule": 1
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)**

```json
{
	"id": 1,
	"created_date": "2023-05-09T14:42:44.507114+03:00",
	"modified_date": "2023-05-09T17:44:28.736384+03:00",
	"is_active": true,
	"code": "alpha_stock_list",
	"name": "Alpha Stock List",
	"remote_id": 4,
	"stock_list_rule": 1
}
```

**Example Response (400 Bad Request)**

```json
{
   "remote_id": [
       "This field is required."
   ],
   "code": [
       "This field is required."
   ],
   "name": [
       "This field is required."
   ],
   "stock_list_rule": [
       "This field is required."
   ]
}
```


# Stock List Rules

Whippy Ware enables stock calculation based on stock locations and providers. In order to do this, the user needs to define a calculation rule which will work in the background of the application. The brand provides stock providers, stock locations, and location-based/independent safety stocks to be used for the preparation of a stock list. Stock list rules should be defined to do this. Rule types can be as follows;

### List Stock List Rules

This method is used to list objects of StockListRule model.

`GET` **List-Stock-List-Rules**

**Path:** `/api/v1/stock-list-rules/`

**Parameters**

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| limit      | integer   | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request**

```py
import requests

url = "https://{whippy_api_url}/api/v1/stock-list-rules/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter      | Data Type  | Description                         |
| -------------- | ---------- | ----------------------------------- |
| id             | string     | The primary key of the created list |
| name           | string     | The name of the rule                |
| rule\_type     | string     | The type of the rule                |
| rule           | dictionary | The rule of the stock list          |
| created\_date  | date       | The creation date                   |
| modified\_date | date       | The last modified date              |
| is\_active     | boolean    | The activation status of the rule   |

```json
{
	"count": 2,
	"next": "http://{whippy_api_url}/api/v1/stock-list-rules/?page=2",
	"previous": null,
	"results": [
    	{
        	"id": 1,
        	"created_date": "2023-05-05T15:54:53.689242+03:00",
        	"modified_date": "2023-05-05T15:54:53.691352+03:00",
        	"is_active": true,
        	"name": "Eshop Stock List Rule",
        	"rule": {},
        	"rule_type": "sql"
    	},
    	{
        	"id": 2,
        	"created_date": "2023-05-08T12:36:08.729480+03:00",
        	"modified_date": "2023-05-08T12:36:08.729561+03:00",
        	"is_active": true,
        	"name": "Webshop Stock List Rule",
        	"rule": {},
        	"rule_type": "sql"
    	}
	]
}
```

### Stock List Rule Instance

This method is used to get stock list rule instance specified with the Rule ID.

`GET` **Stock-List-Rule-Instance**

**Path:** `api/v1/stock-list-rules/{rule_id}/`

**Parameters**

|  Parameter | Data Type |   In   |             Description             |
| :--------: | :-------: | :----: | :---------------------------------: |
| api\_token |   string  | header | The API key of the customer account |
| {rule\_id} |   string  |  query |          The ID of the rule         |

**Example Request**

```py
import requests
url = "https://{whippy_api_url}/api/v1/stock-list-rules/{rule_id}"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter      | Data Type  | Description                         |
| -------------- | ---------- | ----------------------------------- |
| id             | string     | The primary key of the created list |
| name           | string     | The name of the rule                |
| rule\_type     | string     | The type of the rule                |
| rule           | dictionary | The rule of the stock list          |
| created\_date  | date       | The creation date                   |
| modified\_date | date       | The last modified date              |
| is\_active     | boolean    | The activation status of the rule   |

```json
{
	"id": 1,
	"created_date": "2020-01-01T18:25:43.976080+03:00",
	"modified_date": "2020-01-01T18:25:43.976080+03:00",
	"is_active": true,
	"name": "Eshop Stock List Rule",
	"rule": {},
	"rule_type": "sql"
}
```

**Filters**

The applicable filters are as follows.

```json
"filters": {
    	"is_active": {
        	"type": "BooleanFilter",
        	"lookup_types": [
            	"exact"
        	]
    	},
    	"rule_type": {
        	"type": "ChoiceFilter",
        	"lookup_types": [
            	"exact"
        	]
    	},
    	"created_date": {
        	"type": "IsoDateTimeFilter",
        	"lookup_types": [
            	"gt",
            	"gte",
            	"lt",
            	"lte",
            	"exact"
        	]
    	},
    	"modified_date": {
        	"type": "IsoDateTimeFilter",
        	"lookup_types": [
            	"gt",
            	"gte",
            	"lt",
            	"lte",
            	"exact"
        	]
    	},
    	"name": {
        	"type": "CharFilter",
        	"lookup_types": [
            	"icontains"
        	]
    	}
	}
```

### Create Stock List Rule

This method is used to create a new stock list rule object based on the information in the request body.

`POST` **Create-Stock-List-Rule**

**Path:** `/api/v1/stock-list-rules/`

**Example Request**

```py
import requests
import json

url = "https://{whippy_api_url}/api/v1/stock-list-rules/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "name": "Sales channel Stock List Rule",
  "rule_type": "sql",
  "is_active": True,
  "rule": {}
})
headers = {
  'content-type': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}
response = requests.request("POST", url, headers=headers, data=payload)print(response.text)
```

**Example Response (201 Created)**

The response includes the following parameters.

| Parameter      | Data Type  | Description                         |
| -------------- | ---------- | ----------------------------------- |
| id             | string     | The primary key of the created list |
| name           | string     | The name of the rule                |
| rule\_type     | string     | The type of the rule                |
| rule           | dictionary | The rule of the stock list          |
| created\_date  | date       | The creation date                   |
| modified\_date | date       | The last modified date              |
| is\_active     | boolean    | The activation status of the rule   |

```json
{
	"id": 3,
	"created_date": "2023-05-09T11:41:58.884366+03:00",
	"modified_date": "2023-05-09T11:41:58.885409+03:00",
	"is_active": true,
	"name": "Webshop Stock List Rule",
	"rule": {},
	"rule_type": "sql"
}
```

### Search Stock List Rules

This method is used to search stock list rules.

`GET` **Search-Stock-List-Rules**

**Path:** `/api/v1/stock-list-rules/?name=&lt;string>&is_active=&lt;string>&rule_type=&lt;string>&sort=&lt;string>&page=&lt;integer>&limit=&lt;integer>`

**Parameters**

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| name       | string    | query  | The name of the rule                       |
| rule\_type | string    | query  | The type of the rule                       |
| is\_active | boolean   | query  | The activation status of the rule          |
| limit      | integer   | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request**

```py
import requests

url = "https://{whippy_api_url}/api/v1/stock-list-rules/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

params = {
  'rule_type': 'sql'
}

headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=params)

print(response.text)
```

**Example Response (200 OK)**

The list of stock list rule objects according to the filter parameters is returned.

```json
{
   "count": 2,
   "next": "http://{whippy_api_url}/api/v1/stock-list-rules/?page=2&rule_type=sql",
   "previous": null,
   "results": [
       {
           "id": 2,
           "created_date": "2023-05-08T12:36:08.729480+03:00",
           "modified_date": "2023-05-08T12:36:08.729561+03:00",
           "is_active": true,
           "name": "Webshop Stock List Rule",
           "rule": {},
           "rule_type": "sql"
       },
       {
           "id": 3,
           "created_date": "2023-05-09T11:41:58.884366+03:00",
           "modified_date": "2023-05-09T11:41:58.885409+03:00",
           "is_active": true,
           "name": "PetShop Stock List Rule",
           "rule": {},
           "rule_type": "sql"
       }
   ]
}
```

**Filters**

The following filters can be applied via the request URL.

```json
"filters": {
       "is_active": {
           "type": "BooleanFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "rule_type": {
           "type": "ChoiceFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "created_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "modified_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       }
   }
```

### Stock List Rule Partial Update

This method is used to partially update a stock-list-rule object.

`PATCH` **Stock-List-Rule-Partial-Update**

**Path:** `/api/v1/stock-list-rules/{rule_id}/`

**Parameters**

| Parameter  | Data Type | In     | Description                         |
| ---------- | --------- | ------ | ----------------------------------- |
| api\_token | string    | header | The API key of the customer account |
| {rule\_id} | string    | query  | The stock list rule ID              |

**Example Request**

```py
import requests
import json

url = "http://localhost:8000/api/v1/stock-list-rules/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "name": "PetShop Stock List Rule",
  "rule_type": "raw_sql"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)**

The response includes the following parameters.

| Parameter  | Data Type  | Description                         |
| ---------- | ---------- | ----------------------------------- |
| id         | string     | The primary key of the created list |
| name       | string     | The name of the rule                |
| rule\_type | string     | The type of the rule                |
| rule       | dictionary | The rule of the stock list          |
| is\_active | boolean    | The activation status of the rule   |

### Stock List Rule Full Update

This method is used to update all fields of the specified stock list rule object with PUT request.

`PUT` **Stock-List-Rule-Full-Update**

**Path:** `/api/v1/stock-list-rules/{rule_id}/`

**Parameters**

| Parameter  | Data Type | In     | Description                         |
| ---------- | --------- | ------ | ----------------------------------- |
| api\_token | string    | header | The API key of the customer account |
| {rule\_id} | string    | query  | The stock list rule ID              |

**Example Request**

```py
{
	"name": "<string>",
	"rule_type": "<string>",
	"is_active": "<boolean>",
	"rule": "<object>"
}
```

**Example Response (200 OK)**

```json
{
	"id": 1,
	"created_date": "2023-05-09T11:41:58.884366+03:00",
	"modified_date": "2023-05-09T12:59:18.813081+03:00",
	"is_active": true,
	"name": "PetShop Stock List Rule",
	"rule": {},
	"rule_type": "raw_sql"
}
```


# Stock Providers

A general or special to brand provider can be defined via Provider model. The information of the stock provider defined in Whippy Ware needs to be identical to the defined information sent from the brand’s API. Otherwise, Whippy Ware will not be able to register the information received from the service into its own system.

### List Providers​ <a href="#list-providers" id="list-providers"></a>

This method is used to get a list of provider objects.

`GET` **List-Providers**

**Path:** `/api/v1/providers/`

**Parameters​**

The following parameters can be used to get a list of provider objects.

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| limit      | integer   | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/providers/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```
{
    "count": 1,
    "next": "https://{whippy_api_url}/api/v1/providers/?page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "created_date": "2023-05-10T10:08:25.050666+03:00",
            "modified_date": "2023-05-10T10:08:25.058711+03:00",
            "is_active": true,
            "name": "Provider",
            "code": "provider_company",
            "should_add_reservations": false
        }
    ]
}
```

### Provider Instance​ <a href="#provider-instance" id="provider-instance"></a>

This method is used to get the details of the provider object with the specified provider number.

`GET` **Provider-Instance**

**Path:** `/api/v1/providers/{provider_no}`

**Parameters​**

The following parameters can be used to get the details of the provider objects.

| Parameter      | Data Type | In     | Description                         |
| -------------- | --------- | ------ | ----------------------------------- |
| api\_token     | string    | header | The API key of the customer account |
| {provider\_id} | string    | query  | The ID number of the provider       |

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/providers/{provider_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```
{
    "id": 1,
    "created_date": "2023-05-10T10:08:25.050666+03:00",
    "modified_date": "2023-05-10T10:08:25.058711+03:00",
    "is_active": true,
    "name": "Provider",
    "code": "provider_company",
    "should_add_reservations": false
}
```

### Create Provider​ <a href="#create-provider" id="create-provider"></a>

This method is used to create a provider object with the request body.

`POST` **Create-Provider**

**Path:** `/api/v1/providers/`

**Parameters​**

The following parameters can be used to create a provider object.

| Parameter                 | Data Type | In     | Required | Description                         |
| ------------------------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token                | string    | header |     ✓    | The API key of the customer account |
| code                      | string    | body   |     ✓    | The code of the provider            |
| name                      | string    | body   |     ✓    | The name of the provider            |
| should\_add\_reservations | boolean   | body   |          | The status of the reservation       |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/providers/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = payload = json.dumps({
  "name": "Provider 1",
  "code": "provider_1",
  "is_active": True,
  "should_add_reservations": False
})

headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```
{
    "id": 2,
    "created_date": "2023-05-10T11:01:01.404492+03:00",
    "modified_date": "2023-05-10T11:01:01.404542+03:00",
    "is_active": true,
    "name": "Provider 1",
    "code": "provider_1",
    "should_add_reservations": false
}
```

**Example Response (400 Bad Request)​**

```
{
   "name": [
       "This field is required."
   ],
   "code": [
       "This field is required."
   ]
}
```

### Search Providers​ <a href="#search-providers" id="search-providers"></a>

This method is used to search provider objects with the specified filters.

`GET` **Search-Providers**

**Path:** `/api/v1/providers/?code__icontains=<string>&code=<string>&created_date__gt=<string>&created_date__gte=<string>&created_date__lt=<string>&created_date__lte=<string>&created_date=<string>&modified_date__gt=<string>&modified_date__gte=<string>&modified_date__lt=<string>&modified_date__lte=<string>&modified_date=<string>&is_active=<string>&name=<string>&sort=<string>&page=<integer>&limit=<integer>`

**Filters​**

The following parameters can be used to filter GET request results.

| Parameter      | Data Type | In     | Description                         |
| -------------- | --------- | ------ | ----------------------------------- |
| api\_token     | string    | header | The API key of the customer account |
| code           | string    | query  | The code of the provider            |
| name           | string    | query  | The name of the provider            |
| is\_active     | boolean   | query  | The activation status of the rule   |
| created\_date  | date      | query  | The creation date                   |
| modified\_date | date      | query  | The last modified date              |

The following filters can be applied via the request URL.

```
 "filters": {
       "code": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains",
               "exact"
           ]
       },
       "created_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "modified_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "is_active": {
           "type": "BooleanFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       }
   }
```

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/providers/?code__icontains=<string>&code=<string>&created_date__gt=<string>&created_date__gte=<string>&created_date__lt=<string>&created_date__lte=<string>&created_date=<string>&modified_date__gt=<string>&modified_date__gte=<string>&modified_date__lt=<string>&modified_date__lte=<string>&modified_date=<string>&is_active=<string>&name=<string>&sort=<string>&page=<integer>&limit=<integer>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```json
{
    "count": 2,
    "next": http://{whippy_api_url}/api/v1/providers/?name=prov&page=2,
    "previous": null,
    "results": [
        {
            "id": 1,
            "created_date": "2023-05-10T10:08:25.050666+03:00",
            "modified_date": "2023-05-10T10:08:25.058711+03:00",
            "is_active": true,
            "name": "Provider",
            "code": "provider_company",
            "should_add_reservations": false
        },
        {
            "id": 2,
            "created_date": "2023-05-10T11:01:01.404492+03:00",
            "modified_date": "2023-05-10T11:01:01.404542+03:00",
            "is_active": true,
            "name": "Provider 1",
            "code": "provider_1",
            "should_add_reservations": false
        }
    ]
}
```

### Provider Partial Update​ <a href="#provider-partial-update" id="provider-partial-update"></a>

This method is used to partially update the specified provider object with PATCH request.

`PATCH` **Provider-Partial-Update**

**Path:** `/api/v1/providers/{rule_no}/`

**Parameters​**

The following parameters can be used to partially update the provider object.

| Parameter      | Data Type | In     | Description                         |
| -------------- | --------- | ------ | ----------------------------------- |
| api\_token     | string    | header | The API key of the customer account |
| {provider\_id} | string    | query  | The ID number of the provider       |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/providers/{provider_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "should_add_reservations": True
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```json
{
    "id": 1,
    "created_date": "2023-05-10T10:08:25.050666+03:00",
    "modified_date": "2023-05-10T11:14:19.680335+03:00",
    "is_active": true,
    "name": "Provider",
    "code": "provider_company",
    "should_add_reservations": true
}
```

**Example Response (400 Bad Request)​**

```json
{
   "code": [
       "provider with this code already exists."
   ]
}
```

### Provider Full Update​ <a href="#provider-full-update" id="provider-full-update"></a>

This method is used to update all fields of the specified provider object with PUT request.

`PUT` **Provider-Full-Update**

**Path:** `/api/v1/providers/{rule_no}/`

**Parameters​**

The following parameters can be used to full update the provider object.

| Parameter      | Data Type | In     | Description                         |
| -------------- | --------- | ------ | ----------------------------------- |
| api\_token     | string    | header | The API key of the customer account |
| {provider\_id} | string    | query  | The ID number of the provider       |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/providers/{provider_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "name": "Provider",
  "code": "provider",
  "is_active": "false",
  "should_add_reservations": "true"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter                 | Data Type | Description                           |
| ------------------------- | --------- | ------------------------------------- |
| id                        | integer   | The primary key of the provider       |
| name                      | string    | The name of the provider              |
| code                      | string    | The code of the provider              |
| should\_add\_reservations | boolean   | The status of the reservation         |
| created\_date             | date      | The creation date                     |
| modified\_date            | date      | The last modified date                |
| is\_active                | boolean   | The activation status of the Provider |

```json
{
    "id": 1,
    "created_date": "2023-05-10T10:08:25.050666+03:00",
    "modified_date": "2023-05-10T12:21:28.042081+03:00",
    "is_active": false,
    "name": "Provider",
    "code": "provider",
    "should_add_reservations": true
}
```

**Example Response (400 Bad Request)​**

```json
{
   "name": [
       "This field is required."
   ],
   "code": [
       "This field is required."
   ]
}
---
{
   "code": [
       "provider with this code already exists."
   ]
}
```


# Stock Locations

A stock provider may have stock areas located in multiple locations. In order to match these stock locations with the respective stock provider, they need to be defined in Whippy Ware. The brand needs to assign a unique value to each stock location and ensuring that these values are defined both within their own system and in Whippy Ware.

### List Locations​ <a href="#list-locations" id="list-locations"></a>

This method is used to get a list of location objects.

`GET` **List-Locations**

**Path:** `/api/v1/stock-locations/`

**Parameters​**

The following parameters can be used to get a list of location objects.

| Parameter  | Data Type | In     | Description                                |
| ---------- | --------- | ------ | ------------------------------------------ |
| api\_token | string    | header | The API key of the customer account        |
| limit      | integer   | query  | The amount of line items returned per page |
| page       | string    | query  | The number of page returned                |

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/stock-locations/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The provider ID                             |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
    "count": 3,
    "next": "https://{whippy_api_url}/api/v1/stock-locations/?page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "created_date": "2023-05-10T12:30:30.784114+03:00",
            "modified_date": "2023-05-10T12:30:30.784158+03:00",
            "is_active": true,
            "name": "110",
            "code": "110",
            "provider": 1
        },
        {
            "id": 2,
            "created_date": "2023-05-10T12:31:46.773210+03:00",
            "modified_date": "2023-05-10T12:31:46.773249+03:00",
            "is_active": true,
            "name": "112",
            "code": "112",
            "provider": 1
        },
        {
            "id": 3,
            "created_date": "2023-05-10T12:31:56.231437+03:00",
            "modified_date": "2023-05-10T12:31:56.231468+03:00",
            "is_active": true,
            "name": "115",
            "code": "115",
            "provider": 1
        }
    ]
}
```

### Location Instance​ <a href="#location-instance" id="location-instance"></a>

This method is used to get the details of the location object with the specified location ID.

`GET` **Location-Instance**

**Path:** `/api/v1/stock-locations/{location_id}/`

**Parameters​**

The following parameters can be used to get the details of the location objects.

| Parameter      | Data Type | In     | Description                         |
| -------------- | --------- | ------ | ----------------------------------- |
| api\_token     | string    | header | The API key of the customer account |
| {location\_id} | string    | query  | The ID number of the location       |

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/stock-locations/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The stock provider ID                       |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
   "id": 1,
   "created_date": "2023-05-10T12:30:30.784114+03:00",
   "modified_date": "2023-05-10T12:30:30.784158+03:00",
   "is_active": true,
   "name": "110",
   "code": "110",
   "provider": 1
}
```

### Create Location​ <a href="#create-location" id="create-location"></a>

This method is used to create a location object with the request body.

`POST` **Create-Location**

**Path:** `/api/v1/stock-locations/`

**Parameters​**

The following parameters can be used to create a location object.

| Parameter  | Data Type | In     | Required | Description                         |
| ---------- | --------- | ------ | :------: | ----------------------------------- |
| api\_token | string    | header |     ✓    | The API key of the customer account |
| name       | string    | body   |     ✓    | The name of the stock location      |
| code       | string    | body   |     ✓    | The code of the stock location      |
| provider   | integer   | body   |     ✓    | The stock provider ID               |

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/stock-locations/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (201 Created)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The stock provider ID                       |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
    "id": 1,
    "created_date": "2023-05-10T12:30:30.784114+03:00",
    "modified_date": "2023-05-10T12:30:30.784158+03:00",
    "is_active": true,
    "name": "110",
    "code": "110",
    "provider": 1
}
```

**Example Response (400 Bad Request)​**

```
{
   "code": [
       "location with this code already exists."
   ]
}
```

### Search Locations​ <a href="#search-locations" id="search-locations"></a>

This method is used to search location objects with the specified filters.

`GET` **Search-Locations**

**Path:** `/api/v1/stock-locations/?code__icontains=<string>&code=<string>&created_date__gt=<string>&created_date__gte=<string>&created_date__lt=<string>&created_date__lte=<string>&created_date=<string>&modified_date__gt=<string>&modified_date__gte=<string>&modified_date__lt=<string>&modified_date__lte=<string>&modified_date=<string>&is_active=<string>&name=<string>&provider=<string>&provider_name=<string>&sort=<string>&page=<integer>&limit=<integer>`

**Filters​**

The following parameters can be used to filter GET request results.

| Parameter      | Data Type | In     | Description                                 |
| -------------- | --------- | ------ | ------------------------------------------- |
| api\_token     | string    | header | The API key of the customer account         |
| name           | string    | query  | The name of the stock location              |
| code           | string    | query  | The code of the stock location              |
| provider       | string    | query  | The stock provider ID                       |
| provider\_name | string    | query  | The name of the provider                    |
| created\_date  | date      | query  | The creation date                           |
| modified\_date | date      | query  | The last modified date                      |
| is\_active     | boolean   | query  | The activation status of the stock location |

The following filters can be applied via the request URL.

```
"filters": {
       "code": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains",
               "exact"
           ]
       },
       "created_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "modified_date": {
           "type": "IsoDateTimeFilter",
           "lookup_types": [
               "gt",
               "gte",
               "lt",
               "lte",
               "exact"
           ]
       },
       "is_active": {
           "type": "BooleanFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       },
       "provider": {
           "type": "CharFilter",
           "lookup_types": [
               "exact"
           ]
       },
       "provider_name": {
           "type": "CharFilter",
           "lookup_types": [
               "icontains"
           ]
       }
   }
```

**Example Request​**

```
import requests

url = "https://{whippy_api_url}/api/v1/stock-locations/?code__icontains=<string>&code=<string>&created_date__gt=<string>&created_date__gte=<string>&created_date__lt=<string>&created_date__lte=<string>&created_date=<string>&modified_date__gt=<string>&modified_date__gte=<string>&modified_date__lt=<string>&modified_date__lte=<string>&modified_date=<string>&is_active=<string>&name=<string>&provider=<string>&provider_name=<string>&sort=<string>&page=<integer>&limit=<integer>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Token {}'.format(api_token),
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The stock provider ID                       |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
    "count": 3,
    "next": "http://{whippy_api_url}/api/v1/stock-locations/?name=stock&page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "created_date": "2023-05-10T12:30:30.784114+03:00",
            "modified_date": "2023-05-10T12:30:30.784158+03:00",
            "is_active": true,
            "name": "110",
            "code": "110",
            "provider": 1
        },
        {
            "id": 2,
            "created_date": "2023-05-10T12:31:46.773210+03:00",
            "modified_date": "2023-05-10T12:31:46.773249+03:00",
            "is_active": true,
            "name": "112",
            "code": "112",
            "provider": 1
        },
        {
            "id": 3,
            "created_date": "2023-05-10T12:31:56.231437+03:00",
            "modified_date": "2023-05-10T12:31:56.231468+03:00",
            "is_active": true,
            "name": "115",
            "code": "115",
            "provider": 1
        }
    ]
}
```

### Location Partial Update​ <a href="#location-partial-update" id="location-partial-update"></a>

This method is used to partially update the specified location object with PATCH request.

`PATCH` **Location-Partial-Update**

**Path:** `/api/v1/stock-locations/{stocklocation_id}/`

**Parameters​**

The following parameters can be used to partially update the location object.

| Parameter           | Data Type | In     | Description                         |
| ------------------- | --------- | ------ | ----------------------------------- |
| api\_token          | string    | header | The API key of the customer account |
| {stocklocation\_id} | string    | query  | The ID number of the stock location |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stock-locations/{stocklocation_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
 "name": "118",
 "provider": 2,
})

headers = {
 'Content-Type': 'application/json',
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("PATCH", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The stock provider ID                       |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
   "id": 1,
   "created_date": "2023-05-10T12:30:30.784114+03:00",
   "modified_date": "2023-05-10T13:03:13.637252+03:00",
   "is_active": true,
   "name": "118",
   "code": "110",
   "provider": 2
}
```

**Example Response (400 Bad Request)​**

```
{
   "code": [
       "location with this code already exists."
   ]
}
```

### Location Full Update​ <a href="#location-full-update" id="location-full-update"></a>

This method is used to update all fields of the specified location object with PUT request.

`PUT` **Location-Full-Update**

**Path:** `/api/v1/stock-locations/{stocklocation_id}/`

**Parameters​**

The following parameters can be used to full update the location object.

| Parameter           | Data Type | In     | Description                         |
| ------------------- | --------- | ------ | ----------------------------------- |
| api\_token          | string    | header | The API key of the customer account |
| {stocklocation\_id} | string    | query  | The ID number of the stock location |

**Example Request​**

```
import requests
import json

url = "https://{whippy_api_url}/api/v1/stock-locations/{stocklocation_id}/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
  "name": "<string>",
  "code": "<string>",
  "provider": "<integer>",
  "is_active": "<boolean>"
})

headers = {
 'Content-Type': 'application/json',
 'Accept': 'application/json',
 'Authorization': 'Token {}'.format(api_token)
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
```

**Example Response (200 OK)​**

The response includes the following parameters.

| Parameter      | Data Type | Description                                 |
| -------------- | --------- | ------------------------------------------- |
| id             | integer   | The primary key of the stock location       |
| name           | string    | The name of the stock location              |
| code           | string    | The code of the stock location              |
| provider       | integer   | The stock provider ID                       |
| created\_date  | date      | The creation date                           |
| modified\_date | date      | The last modified date                      |
| is\_active     | boolean   | The activation status of the stock location |

```
{
   "id": 1,
   "created_date": "2023-05-10T12:30:30.784114+03:00",
   "modified_date": "2023-05-10T13:03:13.637252+03:00",
   "is_active": true,
   "name": "118",
   "code": "110",
   "provider": 2
}
```

**Example Response (400 Bad Request)​**

```
{
   "code": [
       "location with this code already exists."
   ]
}
---
{
   "name": [
       "This field is required."
   ],
   "code": [
       "This field is required."
   ],
   "provider": [
       "This field is required."
   ]
}
```


# Omnitron OpenAPIs


# Customers

## Retrieve Customer

> Retrieve a specific Customer instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/{id}/":{"get":{"summary":"Retrieve Customer","description":"Retrieve a specific Customer instance by ID","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Customer retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Customer

> Update an existing Customer instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/{id}/":{"put":{"summary":"Update Customer","description":"Update an existing Customer instance by ID","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"responses":{"200":{"description":"Customer updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Customer

> Delete a specific Customer instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/{id}/":{"delete":{"summary":"Delete Customer","description":"Delete a specific Customer instance by ID","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Customer deleted successfully"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partially Update Customer

> Partially update an existing Customer instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/{id}/":{"patch":{"summary":"Partially Update Customer","description":"Partially update an existing Customer instance by ID","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"responses":{"200":{"description":"Customer updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve Customer with Details

> Retrieve a specific Customer instance by ID with additional details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"CustomerDetailed":{"type":"object","allOf":[{"$ref":"#/components/schemas/Customer"}],"properties":{"channel":{"$ref":"#/components/schemas/Channel"},"orders_info":{"type":"object","properties":{"total_order_amount":{"type":"number","nullable":true},"total_refund_amount":{"type":"number","nullable":true},"total_discount_amount":{"type":"number","nullable":true},"total_order_count":{"type":"integer"}}}}},"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/{id}/detailed/":{"get":{"summary":"Retrieve Customer with Details","description":"Retrieve a specific Customer instance by ID with additional details","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Customer with details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetailed"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Customers

> Retrieve a list of customers with optional filters

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"email":{"name":"email","in":"query","description":"Email address of the customer","required":false,"schema":{"type":"string","format":"email"}},"email__startswith":{"name":"email__startswith","in":"query","description":"Email address of the customer starting with the specified value","required":false,"schema":{"type":"string"}},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"channel_code":{"name":"channel_code","in":"query","description":"Code representing the channel the customer belongs to","required":false,"schema":{"type":"string"}},"phone_number":{"name":"phone_number","in":"query","description":"Phone number of the customer","required":false,"schema":{"type":"string"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false},"extra_field__some_key":{"name":"extra_field__some_key","in":"query","description":"Filter by a specific key in the 'extra_field' JSON object.","required":false,"schema":{"type":"string"}},"attributes__some_key":{"name":"attributes__some_key","in":"query","description":"Filter by a specific key in the 'attributes' JSON object.","required":false,"schema":{"type":"string"}},"first_name":{"name":"first_name","in":"query","description":"First name of the customer","required":false,"schema":{"type":"string"}},"last_name":{"name":"last_name","in":"query","description":"Last name of the customer","required":false,"schema":{"type":"string"}},"erp_code":{"name":"erp_code","in":"query","description":"Filter by ERP code (contains)","required":false,"schema":{"type":"string"}},"email_allowed":{"name":"email_allowed","in":"query","description":"Indicates if the customer allows receiving emails","required":false,"schema":{"type":"boolean"}},"sms_allowed":{"name":"sms_allowed","in":"query","description":"Indicates if the customer allows receiving SMS","required":false,"schema":{"type":"boolean"}},"call_allowed":{"name":"call_allowed","in":"query","description":"Indicates if the customer allows receiving calls","required":false,"schema":{"type":"boolean"}},"date_joined":{"name":"date_joined","in":"query","description":"The date when the customer joined","required":false,"schema":{"type":"string","format":"date-time"}},"gender":{"name":"gender","in":"query","description":"Filter by gender","required":false,"schema":{"type":"string","enum":["male","female"]}},"user_type":{"name":"user_type","in":"query","description":"Filter by user type","required":false,"schema":{"type":"string","enum":["guest","registered"]}},"date_of_birth":{"name":"date_of_birth","in":"query","description":"Filter by date of birth","required":false,"schema":{"type":"string","format":"date"}}},"schemas":{"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/":{"get":{"summary":"List Customers","description":"Retrieve a list of customers with optional filters","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/email"},{"$ref":"#/components/parameters/email__startswith"},{"$ref":"#/components/parameters/channel"},{"$ref":"#/components/parameters/channel_code"},{"$ref":"#/components/parameters/phone_number"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/pk__in"},{"$ref":"#/components/parameters/extra_field__some_key"},{"$ref":"#/components/parameters/attributes__some_key"},{"$ref":"#/components/parameters/first_name"},{"$ref":"#/components/parameters/last_name"},{"$ref":"#/components/parameters/erp_code"},{"$ref":"#/components/parameters/email_allowed"},{"$ref":"#/components/parameters/sms_allowed"},{"$ref":"#/components/parameters/call_allowed"},{"$ref":"#/components/parameters/date_joined"},{"$ref":"#/components/parameters/gender"},{"$ref":"#/components/parameters/user_type"},{"$ref":"#/components/parameters/date_of_birth"}],"responses":{"200":{"description":"List of Customers","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create a new Customer

> Create a new Customer instance

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/":{"post":{"summary":"Create a new Customer","description":"Create a new Customer instance","tags":["Customers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"responses":{"201":{"description":"Customer created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Customers with Details

> Retrieve a detailed list of customers with optional filters

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"email":{"name":"email","in":"query","description":"Email address of the customer","required":false,"schema":{"type":"string","format":"email"}},"email__startswith":{"name":"email__startswith","in":"query","description":"Email address of the customer starting with the specified value","required":false,"schema":{"type":"string"}},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"channel_code":{"name":"channel_code","in":"query","description":"Code representing the channel the customer belongs to","required":false,"schema":{"type":"string"}},"phone_number":{"name":"phone_number","in":"query","description":"Phone number of the customer","required":false,"schema":{"type":"string"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false},"extra_field__some_key":{"name":"extra_field__some_key","in":"query","description":"Filter by a specific key in the 'extra_field' JSON object.","required":false,"schema":{"type":"string"}},"attributes__some_key":{"name":"attributes__some_key","in":"query","description":"Filter by a specific key in the 'attributes' JSON object.","required":false,"schema":{"type":"string"}},"first_name":{"name":"first_name","in":"query","description":"First name of the customer","required":false,"schema":{"type":"string"}},"last_name":{"name":"last_name","in":"query","description":"Last name of the customer","required":false,"schema":{"type":"string"}},"erp_code":{"name":"erp_code","in":"query","description":"Filter by ERP code (contains)","required":false,"schema":{"type":"string"}},"email_allowed":{"name":"email_allowed","in":"query","description":"Indicates if the customer allows receiving emails","required":false,"schema":{"type":"boolean"}},"sms_allowed":{"name":"sms_allowed","in":"query","description":"Indicates if the customer allows receiving SMS","required":false,"schema":{"type":"boolean"}},"call_allowed":{"name":"call_allowed","in":"query","description":"Indicates if the customer allows receiving calls","required":false,"schema":{"type":"boolean"}},"date_joined":{"name":"date_joined","in":"query","description":"The date when the customer joined","required":false,"schema":{"type":"string","format":"date-time"}},"gender":{"name":"gender","in":"query","description":"Filter by gender","required":false,"schema":{"type":"string","enum":["male","female"]}},"user_type":{"name":"user_type","in":"query","description":"Filter by user type","required":false,"schema":{"type":"string","enum":["guest","registered"]}},"date_of_birth":{"name":"date_of_birth","in":"query","description":"Filter by date of birth","required":false,"schema":{"type":"string","format":"date"}}},"schemas":{"CustomerDetailed":{"type":"object","allOf":[{"$ref":"#/components/schemas/Customer"}],"properties":{"channel":{"$ref":"#/components/schemas/Channel"},"orders_info":{"type":"object","properties":{"total_order_amount":{"type":"number","nullable":true},"total_refund_amount":{"type":"number","nullable":true},"total_discount_amount":{"type":"number","nullable":true},"total_order_count":{"type":"integer"}}}}},"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/customers/detailed/":{"get":{"summary":"List Customers with Details","description":"Retrieve a detailed list of customers with optional filters","tags":["Customers"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/email"},{"$ref":"#/components/parameters/email__startswith"},{"$ref":"#/components/parameters/channel"},{"$ref":"#/components/parameters/channel_code"},{"$ref":"#/components/parameters/phone_number"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/pk__in"},{"$ref":"#/components/parameters/extra_field__some_key"},{"$ref":"#/components/parameters/attributes__some_key"},{"$ref":"#/components/parameters/first_name"},{"$ref":"#/components/parameters/last_name"},{"$ref":"#/components/parameters/erp_code"},{"$ref":"#/components/parameters/email_allowed"},{"$ref":"#/components/parameters/sms_allowed"},{"$ref":"#/components/parameters/call_allowed"},{"$ref":"#/components/parameters/date_joined"},{"$ref":"#/components/parameters/gender"},{"$ref":"#/components/parameters/user_type"},{"$ref":"#/components/parameters/date_of_birth"}],"responses":{"200":{"description":"List of Customers with Details","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CustomerDetailed"}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Reporting

## GET /reporting/{id}/download/

> Download a report file

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"410":{"description":"The requested resource is no longer available."},"500":{"description":"Server Error"}}},"paths":{"/reporting/{id}/download/":{"get":{"summary":"Download a report file","tags":["Reporting"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Successful response, returns the report file","content":{"text/csv":{"schema":{"type":"string","format":"binary"}},"application/vnd.ms-excel":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"410":{"$ref":"#/components/responses/410"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## GET /reporting/remote/{channel\_id}/customer/

> Request a remote customer report

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"channel_path":{"name":"channel_id","in":"path","description":"The channel ID of the resource.","required":true,"schema":{"type":"integer"}},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"email_allowed":{"name":"email_allowed","in":"query","description":"Indicates if the customer allows receiving emails","required":false,"schema":{"type":"boolean"}},"sms_allowed":{"name":"sms_allowed","in":"query","description":"Indicates if the customer allows receiving SMS","required":false,"schema":{"type":"boolean"}},"call_allowed":{"name":"call_allowed","in":"query","description":"Indicates if the customer allows receiving calls","required":false,"schema":{"type":"boolean"}},"export_format":{"name":"export_format","in":"query","description":"Export format for the report","required":false,"schema":{"type":"string","enum":["csv","xls"],"default":"csv"}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/reporting/remote/{channel_id}/customer/":{"get":{"summary":"Request a remote customer report","tags":["Reporting"],"parameters":[{"$ref":"#/components/parameters/channel_path"},{"$ref":"#/components/parameters/channel"},{"$ref":"#/components/parameters/start_date"},{"$ref":"#/components/parameters/end_date"},{"$ref":"#/components/parameters/email_allowed"},{"$ref":"#/components/parameters/sms_allowed"},{"$ref":"#/components/parameters/call_allowed"},{"$ref":"#/components/parameters/export_format"}],"responses":{"200":{"description":"Report request received","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## GET /reporting/sales/

> Request a sales report

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"product__sku":{"name":"product__sku","in":"query","description":"Filter by SKU.","required":false,"schema":{"type":"string"}},"product__base_code":{"name":"product__base_code","in":"query","description":"Filter by base code.","required":false,"schema":{"type":"string"}},"export_format":{"name":"export_format","in":"query","description":"Export format for the report","required":false,"schema":{"type":"string","enum":["csv","xls"],"default":"csv"}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/reporting/sales/":{"get":{"summary":"Request a sales report","tags":["Reporting"],"parameters":[{"in":"query","name":"order__channel","schema":{"type":"integer"},"required":false},{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/product__sku"},{"$ref":"#/components/parameters/product__base_code"},{"$ref":"#/components/parameters/export_format"}],"responses":{"200":{"description":"Report request received","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## GET /reporting/order/

> Request an order report

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"cancel_status":{"name":"cancel_status","in":"query","description":"Filter by cancel status","required":false,"schema":{"type":"string","enum":["waiting","confirmation_waiting","confirmed","approved","rejected","waiting_for_payment","manuel_refund_need","completed"]}},"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"export_format":{"name":"export_format","in":"query","description":"Export format for the report","required":false,"schema":{"type":"string","enum":["csv","xls"],"default":"csv"}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/reporting/order/":{"get":{"summary":"Request an order report","tags":["Reporting"],"parameters":[{"$ref":"#/components/parameters/channel"},{"$ref":"#/components/parameters/cancel_status"},{"$ref":"#/components/parameters/start_date"},{"$ref":"#/components/parameters/end_date"},{"$ref":"#/components/parameters/export_format"}],"responses":{"200":{"description":"Report request received","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Deleted Items

## GET /deleted\_items/

> Retrieve a list of deleted items

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"object_id":{"name":"object_id","in":"query","description":"Filter by object ID","required":false,"schema":{"type":"string"}},"content_type_model":{"name":"content_type_model","in":"query","description":"Filter by content type model","required":false,"schema":{"type":"string"}},"deleted_date":{"name":"deleted_date","in":"query","required":false,"description":"Filter by deletion date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"content_type":{"name":"content_type","in":"query","description":"Filter by content type","required":false,"schema":{"type":"integer"}}},"schemas":{"DeletedItem":{"type":"object","properties":{"id":{"type":"integer"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"string"},"deleted_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}}},"paths":{"/deleted_items/":{"get":{"summary":"Retrieve a list of deleted items","tags":["Deleted Items"],"parameters":[{"$ref":"#/components/parameters/object_id"},{"$ref":"#/components/parameters/content_type_model"},{"$ref":"#/components/parameters/deleted_date"},{"$ref":"#/components/parameters/content_type"}],"responses":{"200":{"description":"A list of deleted items","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeletedItem"}}}}}}}}}}
```


# Pos

## GET /api/v1/pos/{id}/

> Retrieve a specific pos object

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Pos":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the POS (Point of Sale) system."},"channel":{"$ref":"#/components/schemas/Channel","description":"Reference to the channel associated with the POS system."},"name":{"type":"string","maxLength":64,"description":"Name of the POS system."},"slug":{"type":"string","maxLength":64,"description":"Unique slug used to identify the POS system."},"gateway":{"type":"string","maxLength":128,"enum":["garanti","nestpay","cmi","posnet","payu","mastercard","masterpass","bex","hyperpay","payu_poland","payu_romania","payu_ro","fastpay","maximumpay","liqpay","gpay","easypay","mobilexpress","mobilexpress_credit_card","iyzico","iyzico_bkm","finansbank","denizbank","yandex_money","paypal","alpha","dummypay","ykb_credit","compay","compay_credit","param","garanti_switch","pay_with_iyzico","tompay","iyzico_funds_transfer","paycell","posas_giftcard","multisafepay","garanti_credit","multisafepay_direct","ozan","netopia","teqpay","payu_pl","stripe","bulut","fiba_credit","mobilexpress_hosted","paymob","tompay_credit","paytr","payzee","mobilexpress_v8_cc","ykb_worldpay","extension","vakifbank","bulut_direct","eren_card","craftgate","iyzico_saved_card","checkout","checkout_apple_pay","zip_credit","mobilexpress_wire_transfer","payu_ro_paybyclick","payu_ro_saved_card","paybyme","sipay","paywall","dummy_psp","tap","qpay_tap","tap_saved_card","akbank","hepsipay","qnb_pay"],"description":"Payment gateway associated with the POS system. This field represents an enumerated value."},"resource_url":{"type":"string","format":"uri","description":"URL of the POS resource."},"three_d_resource_url":{"type":"string","format":"uri","nullable":true,"description":"Optional URL for 3D secure payments via the POS system."},"config":{"type":"object","additionalProperties":{"type":"string"},"description":"JSON configuration for the POS system settings."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was created."},"modified_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was last modified."}},"required":["name","slug","gateway","resource_url","channel"],"description":"The Pos model represents a Point of Sale system used for processing payments. It includes details such as the name, slug, payment gateway, resource URLs, and configuration settings. It is associated with a specific channel and can be integrated with external systems via the integration field."},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}},"responses":{"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/pos/{id}/":{"get":{"summary":"Retrieve a specific pos object","tags":["Pos"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"The requested pos object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pos"}}}},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## PUT /api/v1/pos/{id}/

> Update a specific pos.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Pos":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the POS (Point of Sale) system."},"channel":{"$ref":"#/components/schemas/Channel","description":"Reference to the channel associated with the POS system."},"name":{"type":"string","maxLength":64,"description":"Name of the POS system."},"slug":{"type":"string","maxLength":64,"description":"Unique slug used to identify the POS system."},"gateway":{"type":"string","maxLength":128,"enum":["garanti","nestpay","cmi","posnet","payu","mastercard","masterpass","bex","hyperpay","payu_poland","payu_romania","payu_ro","fastpay","maximumpay","liqpay","gpay","easypay","mobilexpress","mobilexpress_credit_card","iyzico","iyzico_bkm","finansbank","denizbank","yandex_money","paypal","alpha","dummypay","ykb_credit","compay","compay_credit","param","garanti_switch","pay_with_iyzico","tompay","iyzico_funds_transfer","paycell","posas_giftcard","multisafepay","garanti_credit","multisafepay_direct","ozan","netopia","teqpay","payu_pl","stripe","bulut","fiba_credit","mobilexpress_hosted","paymob","tompay_credit","paytr","payzee","mobilexpress_v8_cc","ykb_worldpay","extension","vakifbank","bulut_direct","eren_card","craftgate","iyzico_saved_card","checkout","checkout_apple_pay","zip_credit","mobilexpress_wire_transfer","payu_ro_paybyclick","payu_ro_saved_card","paybyme","sipay","paywall","dummy_psp","tap","qpay_tap","tap_saved_card","akbank","hepsipay","qnb_pay"],"description":"Payment gateway associated with the POS system. This field represents an enumerated value."},"resource_url":{"type":"string","format":"uri","description":"URL of the POS resource."},"three_d_resource_url":{"type":"string","format":"uri","nullable":true,"description":"Optional URL for 3D secure payments via the POS system."},"config":{"type":"object","additionalProperties":{"type":"string"},"description":"JSON configuration for the POS system settings."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was created."},"modified_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was last modified."}},"required":["name","slug","gateway","resource_url","channel"],"description":"The Pos model represents a Point of Sale system used for processing payments. It includes details such as the name, slug, payment gateway, resource URLs, and configuration settings. It is associated with a specific channel and can be integrated with external systems via the integration field."},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/pos/{id}/":{"put":{"summary":"Update a specific pos.","tags":["Pos"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pos"}}}},"responses":{"200":{"description":"The updated pos object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pos"}}}},"400":{"$ref":"#/components/responses/400"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## DELETE /api/v1/pos/{id}/

> Delete a specific pos object

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"204":{"description":"No content"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/pos/{id}/":{"delete":{"summary":"Delete a specific pos object","tags":["Pos"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## GET /api/v1/pos/

> List all pos entries

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id":{"name":"id","in":"query","required":false,"description":"Filters by id","schema":{"type":"integer"}},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}}},"schemas":{"Pos":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the POS (Point of Sale) system."},"channel":{"$ref":"#/components/schemas/Channel","description":"Reference to the channel associated with the POS system."},"name":{"type":"string","maxLength":64,"description":"Name of the POS system."},"slug":{"type":"string","maxLength":64,"description":"Unique slug used to identify the POS system."},"gateway":{"type":"string","maxLength":128,"enum":["garanti","nestpay","cmi","posnet","payu","mastercard","masterpass","bex","hyperpay","payu_poland","payu_romania","payu_ro","fastpay","maximumpay","liqpay","gpay","easypay","mobilexpress","mobilexpress_credit_card","iyzico","iyzico_bkm","finansbank","denizbank","yandex_money","paypal","alpha","dummypay","ykb_credit","compay","compay_credit","param","garanti_switch","pay_with_iyzico","tompay","iyzico_funds_transfer","paycell","posas_giftcard","multisafepay","garanti_credit","multisafepay_direct","ozan","netopia","teqpay","payu_pl","stripe","bulut","fiba_credit","mobilexpress_hosted","paymob","tompay_credit","paytr","payzee","mobilexpress_v8_cc","ykb_worldpay","extension","vakifbank","bulut_direct","eren_card","craftgate","iyzico_saved_card","checkout","checkout_apple_pay","zip_credit","mobilexpress_wire_transfer","payu_ro_paybyclick","payu_ro_saved_card","paybyme","sipay","paywall","dummy_psp","tap","qpay_tap","tap_saved_card","akbank","hepsipay","qnb_pay"],"description":"Payment gateway associated with the POS system. This field represents an enumerated value."},"resource_url":{"type":"string","format":"uri","description":"URL of the POS resource."},"three_d_resource_url":{"type":"string","format":"uri","nullable":true,"description":"Optional URL for 3D secure payments via the POS system."},"config":{"type":"object","additionalProperties":{"type":"string"},"description":"JSON configuration for the POS system settings."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was created."},"modified_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was last modified."}},"required":["name","slug","gateway","resource_url","channel"],"description":"The Pos model represents a Point of Sale system used for processing payments. It includes details such as the name, slug, payment gateway, resource URLs, and configuration settings. It is associated with a specific channel and can be integrated with external systems via the integration field."},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}}},"paths":{"/api/v1/pos/":{"get":{"summary":"List all pos entries","tags":["Pos"],"parameters":[{"$ref":"#/components/parameters/id"},{"$ref":"#/components/parameters/channel"},{"$ref":"#/components/parameters/modified_date"}],"responses":{"200":{"description":"A list of pos entries.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Pos"}}}}}}}}}}
```

## POST /api/v1/pos/

> Create a new pos object

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Pos":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the POS (Point of Sale) system."},"channel":{"$ref":"#/components/schemas/Channel","description":"Reference to the channel associated with the POS system."},"name":{"type":"string","maxLength":64,"description":"Name of the POS system."},"slug":{"type":"string","maxLength":64,"description":"Unique slug used to identify the POS system."},"gateway":{"type":"string","maxLength":128,"enum":["garanti","nestpay","cmi","posnet","payu","mastercard","masterpass","bex","hyperpay","payu_poland","payu_romania","payu_ro","fastpay","maximumpay","liqpay","gpay","easypay","mobilexpress","mobilexpress_credit_card","iyzico","iyzico_bkm","finansbank","denizbank","yandex_money","paypal","alpha","dummypay","ykb_credit","compay","compay_credit","param","garanti_switch","pay_with_iyzico","tompay","iyzico_funds_transfer","paycell","posas_giftcard","multisafepay","garanti_credit","multisafepay_direct","ozan","netopia","teqpay","payu_pl","stripe","bulut","fiba_credit","mobilexpress_hosted","paymob","tompay_credit","paytr","payzee","mobilexpress_v8_cc","ykb_worldpay","extension","vakifbank","bulut_direct","eren_card","craftgate","iyzico_saved_card","checkout","checkout_apple_pay","zip_credit","mobilexpress_wire_transfer","payu_ro_paybyclick","payu_ro_saved_card","paybyme","sipay","paywall","dummy_psp","tap","qpay_tap","tap_saved_card","akbank","hepsipay","qnb_pay"],"description":"Payment gateway associated with the POS system. This field represents an enumerated value."},"resource_url":{"type":"string","format":"uri","description":"URL of the POS resource."},"three_d_resource_url":{"type":"string","format":"uri","nullable":true,"description":"Optional URL for 3D secure payments via the POS system."},"config":{"type":"object","additionalProperties":{"type":"string"},"description":"JSON configuration for the POS system settings."},"created_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was created."},"modified_date":{"type":"string","format":"date-time","description":"Timestamp when the POS system was last modified."}},"required":["name","slug","gateway","resource_url","channel"],"description":"The Pos model represents a Point of Sale system used for processing payments. It includes details such as the name, slug, payment gateway, resource URLs, and configuration settings. It is associated with a specific channel and can be integrated with external systems via the integration field."},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}}}},"paths":{"/api/v1/pos/":{"post":{"summary":"Create a new pos object","tags":["Pos"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pos"}}}},"responses":{"201":{"description":"The pos was successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pos"}}}},"400":{"$ref":"#/components/responses/400"}}}}}}
```


# Attribute Values

## Retrieve an attribute value

> Retrieve an attribute value by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"AttributeValue":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"attribute":{"$ref":"#/components/schemas/Attribute"},"label":{"type":"string","nullable":true,"description":"The display label of the attribute value"},"value":{"type":"string","description":"The actual value of the attribute"},"order":{"type":"integer","nullable":true,"description":"Order of the attribute value"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"created_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was created"},"modified_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was last modified"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"default_value":{"$ref":"#/components/schemas/AttributeValue"},"entity_type":{"$ref":"#/components/schemas/ContentType"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"pre_attribute":{"type":"boolean","description":"Is this attribute a pre-attribute?"},"description":{"type":"string","nullable":true,"description":"Description of the attribute"},"name":{"type":"string","maxLength":255,"description":"Name of the attribute"},"key":{"type":"string","maxLength":255,"description":"Key of the attribute"},"data_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["text","email","text_area","date","datetime","boolean","valuelabel","dropdown","multiple","price","nested_object","image","file","model","bundle"]}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/{id}/":{"get":{"summary":"Retrieve an attribute value","description":"Retrieve an attribute value by ID.","tags":["AttributeValues"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"An attribute value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update an attribute value

> Update an attribute value by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"AttributeValue":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"attribute":{"$ref":"#/components/schemas/Attribute"},"label":{"type":"string","nullable":true,"description":"The display label of the attribute value"},"value":{"type":"string","description":"The actual value of the attribute"},"order":{"type":"integer","nullable":true,"description":"Order of the attribute value"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"created_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was created"},"modified_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was last modified"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"default_value":{"$ref":"#/components/schemas/AttributeValue"},"entity_type":{"$ref":"#/components/schemas/ContentType"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"pre_attribute":{"type":"boolean","description":"Is this attribute a pre-attribute?"},"description":{"type":"string","nullable":true,"description":"Description of the attribute"},"name":{"type":"string","maxLength":255,"description":"Name of the attribute"},"key":{"type":"string","maxLength":255,"description":"Key of the attribute"},"data_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["text","email","text_area","date","datetime","boolean","valuelabel","dropdown","multiple","price","nested_object","image","file","model","bundle"]}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/{id}/":{"put":{"summary":"Update an attribute value","description":"Update an attribute value by ID.","tags":["AttributeValues"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"responses":{"200":{"description":"Attribute value updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete an attribute value

> Delete an attribute value by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/{id}/":{"delete":{"summary":"Delete an attribute value","description":"Delete an attribute value by ID.","tags":["AttributeValues"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Attribute value deleted successfully."},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial update an attribute value

> Partial update an attribute value by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"AttributeValue":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"attribute":{"$ref":"#/components/schemas/Attribute"},"label":{"type":"string","nullable":true,"description":"The display label of the attribute value"},"value":{"type":"string","description":"The actual value of the attribute"},"order":{"type":"integer","nullable":true,"description":"Order of the attribute value"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"created_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was created"},"modified_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was last modified"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"default_value":{"$ref":"#/components/schemas/AttributeValue"},"entity_type":{"$ref":"#/components/schemas/ContentType"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"pre_attribute":{"type":"boolean","description":"Is this attribute a pre-attribute?"},"description":{"type":"string","nullable":true,"description":"Description of the attribute"},"name":{"type":"string","maxLength":255,"description":"Name of the attribute"},"key":{"type":"string","maxLength":255,"description":"Key of the attribute"},"data_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["text","email","text_area","date","datetime","boolean","valuelabel","dropdown","multiple","price","nested_object","image","file","model","bundle"]}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/{id}/":{"patch":{"summary":"Partial update an attribute value","description":"Partial update an attribute value by ID.","tags":["AttributeValues"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"responses":{"200":{"description":"Attribute value updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create an attribute value

> Create an attribute value.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"AttributeValue":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"attribute":{"$ref":"#/components/schemas/Attribute"},"label":{"type":"string","nullable":true,"description":"The display label of the attribute value"},"value":{"type":"string","description":"The actual value of the attribute"},"order":{"type":"integer","nullable":true,"description":"Order of the attribute value"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"created_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was created"},"modified_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was last modified"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"default_value":{"$ref":"#/components/schemas/AttributeValue"},"entity_type":{"$ref":"#/components/schemas/ContentType"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"pre_attribute":{"type":"boolean","description":"Is this attribute a pre-attribute?"},"description":{"type":"string","nullable":true,"description":"Description of the attribute"},"name":{"type":"string","maxLength":255,"description":"Name of the attribute"},"key":{"type":"string","maxLength":255,"description":"Key of the attribute"},"data_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["text","email","text_area","date","datetime","boolean","valuelabel","dropdown","multiple","price","nested_object","image","file","model","bundle"]}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/":{"post":{"summary":"Create an attribute value","description":"Create an attribute value.","tags":["AttributeValues"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"responses":{"201":{"description":"Attribute value created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeValue"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"406":{"$ref":"#/components/responses/406"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Attribute Values

## List attribute values

> Retrieve a list of attribute values with optional filtering.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"label":{"name":"label","in":"query","description":"The display label of the attribute value","required":false,"schema":{"type":"string"}},"value":{"name":"value","in":"query","description":"Filter by value (contains)","required":false,"schema":{"type":"string"}},"erp_code":{"name":"erp_code","in":"query","description":"Filter by ERP code (contains)","required":false,"schema":{"type":"string"}},"value__exact":{"name":"value__exact","in":"query","description":"Filter by value (exact match)","required":false,"schema":{"type":"string"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false},"attribute":{"name":"attribute","in":"query","description":"Filter by related attribute ID","required":false,"schema":{"type":"integer","format":"int64"}}},"schemas":{"AttributeValue":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"attribute":{"$ref":"#/components/schemas/Attribute"},"label":{"type":"string","nullable":true,"description":"The display label of the attribute value"},"value":{"type":"string","description":"The actual value of the attribute"},"order":{"type":"integer","nullable":true,"description":"Order of the attribute value"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"created_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was created"},"modified_date":{"type":"string","format":"date-time","description":"Date and time when the attribute value was last modified"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"default_value":{"$ref":"#/components/schemas/AttributeValue"},"entity_type":{"$ref":"#/components/schemas/ContentType"},"erp_code":{"type":"string","maxLength":255,"description":"ERP code for integration purposes"},"pre_attribute":{"type":"boolean","description":"Is this attribute a pre-attribute?"},"description":{"type":"string","nullable":true,"description":"Description of the attribute"},"name":{"type":"string","maxLength":255,"description":"Name of the attribute"},"key":{"type":"string","maxLength":255,"description":"Key of the attribute"},"data_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["text","email","text_area","date","datetime","boolean","valuelabel","dropdown","multiple","price","nested_object","image","file","model","bundle"]}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/attribute_value/":{"get":{"summary":"List attribute values","description":"Retrieve a list of attribute values with optional filtering.","tags":["Attribute Values"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/label"},{"$ref":"#/components/parameters/value"},{"$ref":"#/components/parameters/erp_code"},{"$ref":"#/components/parameters/value__exact"},{"$ref":"#/components/parameters/pk__in"},{"$ref":"#/components/parameters/attribute"}],"responses":{"200":{"description":"A list of attribute values.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AttributeValue"}}}}},"401":{"$ref":"#/components/responses/401"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Providers

## Retrieve a provider

> Retrieve details of a specific OAuth provider by slug.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"schemas":{"Provider":{"type":"object","properties":{"name":{"type":"string","maxLength":256,"description":"The name of the OAuth provider."},"slug":{"type":"string","maxLength":256,"description":"A unique slug identifier for the provider."},"icon":{"type":"string","format":"uri","description":"URL of the provider's icon."},"client_id":{"type":"string","maxLength":256,"description":"Client ID for the OAuth provider."},"client_secret":{"type":"string","maxLength":512,"description":"Client secret for the OAuth provider."},"authorization_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the authorization endpoint of the provider."},"token_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the token endpoint of the provider."},"userinfo_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the user information endpoint of the provider."},"whitelist":{"type":"array","items":{"type":"string","format":"uri","maxLength":512},"description":"A list of URLs whitelisted for the provider."},"provider":{"type":"string","maxLength":32,"enum":["azure","github","google","turkcell"],"description":"The type of provider. Possible values: `azure`, `github`, `google`, `turkcell`."},"kwargs":{"type":"object","description":"Additional parameters for the provider."},"is_active":{"type":"boolean","description":"Indicates whether the provider is active."}}}},"responses":{"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/oauth/{slug}/":{"get":{"summary":"Retrieve a provider","description":"Retrieve details of a specific OAuth provider by slug.","tags":["Providers"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"responses":{"200":{"description":"Provider details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Provider"}}}},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Update a provider

> Update the details of an existing OAuth provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"schemas":{"Provider":{"type":"object","properties":{"name":{"type":"string","maxLength":256,"description":"The name of the OAuth provider."},"slug":{"type":"string","maxLength":256,"description":"A unique slug identifier for the provider."},"icon":{"type":"string","format":"uri","description":"URL of the provider's icon."},"client_id":{"type":"string","maxLength":256,"description":"Client ID for the OAuth provider."},"client_secret":{"type":"string","maxLength":512,"description":"Client secret for the OAuth provider."},"authorization_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the authorization endpoint of the provider."},"token_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the token endpoint of the provider."},"userinfo_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the user information endpoint of the provider."},"whitelist":{"type":"array","items":{"type":"string","format":"uri","maxLength":512},"description":"A list of URLs whitelisted for the provider."},"provider":{"type":"string","maxLength":32,"enum":["azure","github","google","turkcell"],"description":"The type of provider. Possible values: `azure`, `github`, `google`, `turkcell`."},"kwargs":{"type":"object","description":"Additional parameters for the provider."},"is_active":{"type":"boolean","description":"Indicates whether the provider is active."}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/oauth/{slug}/":{"put":{"summary":"Update a provider","description":"Update the details of an existing OAuth provider. Only superusers can perform this action.","tags":["Providers"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Provider"}}}},"responses":{"200":{"description":"Provider updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Provider"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Delete a provider

> Delete an OAuth provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"responses":{"204":{"description":"No content"},"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/oauth/{slug}/":{"delete":{"summary":"Delete a provider","description":"Delete an OAuth provider. Only superusers can perform this action.","tags":["Providers"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## List all providers

> Retrieve a list of all OAuth providers. Non-superusers only see active providers.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Provider":{"type":"object","properties":{"name":{"type":"string","maxLength":256,"description":"The name of the OAuth provider."},"slug":{"type":"string","maxLength":256,"description":"A unique slug identifier for the provider."},"icon":{"type":"string","format":"uri","description":"URL of the provider's icon."},"client_id":{"type":"string","maxLength":256,"description":"Client ID for the OAuth provider."},"client_secret":{"type":"string","maxLength":512,"description":"Client secret for the OAuth provider."},"authorization_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the authorization endpoint of the provider."},"token_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the token endpoint of the provider."},"userinfo_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the user information endpoint of the provider."},"whitelist":{"type":"array","items":{"type":"string","format":"uri","maxLength":512},"description":"A list of URLs whitelisted for the provider."},"provider":{"type":"string","maxLength":32,"enum":["azure","github","google","turkcell"],"description":"The type of provider. Possible values: `azure`, `github`, `google`, `turkcell`."},"kwargs":{"type":"object","description":"Additional parameters for the provider."},"is_active":{"type":"boolean","description":"Indicates whether the provider is active."}}}}},"paths":{"/api/v1/oauth/":{"get":{"summary":"List all providers","description":"Retrieve a list of all OAuth providers. Non-superusers only see active providers.","tags":["Providers"],"responses":{"200":{"description":"A list of OAuth providers.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Provider"}}}}}}}}}}
```

## Create a new provider

> Create a new OAuth provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Provider":{"type":"object","properties":{"name":{"type":"string","maxLength":256,"description":"The name of the OAuth provider."},"slug":{"type":"string","maxLength":256,"description":"A unique slug identifier for the provider."},"icon":{"type":"string","format":"uri","description":"URL of the provider's icon."},"client_id":{"type":"string","maxLength":256,"description":"Client ID for the OAuth provider."},"client_secret":{"type":"string","maxLength":512,"description":"Client secret for the OAuth provider."},"authorization_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the authorization endpoint of the provider."},"token_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the token endpoint of the provider."},"userinfo_url":{"type":"string","format":"uri","maxLength":512,"description":"The URL for the user information endpoint of the provider."},"whitelist":{"type":"array","items":{"type":"string","format":"uri","maxLength":512},"description":"A list of URLs whitelisted for the provider."},"provider":{"type":"string","maxLength":32,"enum":["azure","github","google","turkcell"],"description":"The type of provider. Possible values: `azure`, `github`, `google`, `turkcell`."},"kwargs":{"type":"object","description":"Additional parameters for the provider."},"is_active":{"type":"boolean","description":"Indicates whether the provider is active."}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/oauth/":{"post":{"summary":"Create a new provider","description":"Create a new OAuth provider. Only superusers can perform this action.","tags":["Providers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Provider"}}}},"responses":{"201":{"description":"Provider created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Provider"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```


# LDAPProviders

## Authorize an LDAP provider and retrieve a token

> Authorizes the LDAP provider by slug and returns an authorization token.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/ldap/{slug}/authorize/":{"post":{"tags":["LDAPProviders"],"summary":"Authorize an LDAP provider and retrieve a token","description":"Authorizes the LDAP provider by slug and returns an authorization token.","parameters":[{"$ref":"#/components/parameters/slug_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","description":"Username to authorize"},"password":{"type":"string","description":"Password for the given username"}}}}}},"responses":{"200":{"description":"Authorization successful, returns the token.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","description":"Authorization token returned after a successful login."}}}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Retrieve LDAP provider

> Retrieve details for a specific LDAP provider by slug.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"schemas":{"LDAPProvider":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"LDAP Provider ID"},"name":{"type":"string","maxLength":256,"description":"Name of the LDAP provider."},"slug":{"type":"string","maxLength":256,"description":"Unique slug for the LDAP provider."},"icon":{"type":"string","format":"binary","description":"Icon for the LDAP provider."},"host":{"type":"string","format":"url","description":"Host URL for the LDAP provider."},"port":{"type":"integer","description":"Port number to connect to the LDAP server.","maximum":65535},"use_ssl":{"type":"boolean","description":"Indicates whether SSL is used for the LDAP connection."},"bind_dn":{"type":"string","maxLength":256,"description":"The distinguished name (DN) for binding to the LDAP server."},"bind_password":{"type":"string","maxLength":512,"description":"Password for the LDAP bind user."},"base_dn":{"type":"string","maxLength":256,"description":"The base distinguished name (DN) for LDAP searches."},"attribute_map":{"type":"object","description":"A mapping of LDAP attributes to system fields."},"is_active":{"type":"boolean","description":"Indicates if the LDAP provider is active."}}}},"responses":{"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/ldap/{slug}/":{"get":{"summary":"Retrieve LDAP provider","description":"Retrieve details for a specific LDAP provider by slug.","tags":["LDAPProviders"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"responses":{"200":{"description":"LDAP provider details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LDAPProvider"}}}},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update LDAP provider

> Update an existing LDAP provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"schemas":{"LDAPProvider":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"LDAP Provider ID"},"name":{"type":"string","maxLength":256,"description":"Name of the LDAP provider."},"slug":{"type":"string","maxLength":256,"description":"Unique slug for the LDAP provider."},"icon":{"type":"string","format":"binary","description":"Icon for the LDAP provider."},"host":{"type":"string","format":"url","description":"Host URL for the LDAP provider."},"port":{"type":"integer","description":"Port number to connect to the LDAP server.","maximum":65535},"use_ssl":{"type":"boolean","description":"Indicates whether SSL is used for the LDAP connection."},"bind_dn":{"type":"string","maxLength":256,"description":"The distinguished name (DN) for binding to the LDAP server."},"bind_password":{"type":"string","maxLength":512,"description":"Password for the LDAP bind user."},"base_dn":{"type":"string","maxLength":256,"description":"The base distinguished name (DN) for LDAP searches."},"attribute_map":{"type":"object","description":"A mapping of LDAP attributes to system fields."},"is_active":{"type":"boolean","description":"Indicates if the LDAP provider is active."}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"},"500":{"description":"Server Error"}}},"paths":{"/api/v1/ldap/{slug}/":{"put":{"summary":"Update LDAP provider","description":"Update an existing LDAP provider. Only superusers can perform this action.","tags":["LDAPProviders"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LDAPProvider"}}},"description":"LDAP provider object to update."},"responses":{"200":{"description":"LDAP provider updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LDAPProvider"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete LDAP provider

> Delete an existing LDAP provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"slug_path":{"name":"slug","in":"path","description":"The slug of the resource.","required":true,"schema":{"type":"string"}}},"responses":{"204":{"description":"No content"},"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/ldap/{slug}/":{"delete":{"summary":"Delete LDAP provider","description":"Delete an existing LDAP provider. Only superusers can perform this action.","tags":["LDAPProviders"],"parameters":[{"$ref":"#/components/parameters/slug_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List LDAP providers

> Retrieve a list of all LDAP providers. Non-superusers only can see active providers.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"LDAPProvider":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"LDAP Provider ID"},"name":{"type":"string","maxLength":256,"description":"Name of the LDAP provider."},"slug":{"type":"string","maxLength":256,"description":"Unique slug for the LDAP provider."},"icon":{"type":"string","format":"binary","description":"Icon for the LDAP provider."},"host":{"type":"string","format":"url","description":"Host URL for the LDAP provider."},"port":{"type":"integer","description":"Port number to connect to the LDAP server.","maximum":65535},"use_ssl":{"type":"boolean","description":"Indicates whether SSL is used for the LDAP connection."},"bind_dn":{"type":"string","maxLength":256,"description":"The distinguished name (DN) for binding to the LDAP server."},"bind_password":{"type":"string","maxLength":512,"description":"Password for the LDAP bind user."},"base_dn":{"type":"string","maxLength":256,"description":"The base distinguished name (DN) for LDAP searches."},"attribute_map":{"type":"object","description":"A mapping of LDAP attributes to system fields."},"is_active":{"type":"boolean","description":"Indicates if the LDAP provider is active."}}}},"responses":{"500":{"description":"Server Error"}}},"paths":{"/api/v1/ldap/":{"get":{"summary":"List LDAP providers","description":"Retrieve a list of all LDAP providers. Non-superusers only can see active providers.","tags":["LDAPProviders"],"responses":{"200":{"description":"List of LDAP providers","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LDAPProvider"}}}}},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create LDAP provider

> Create a new LDAP provider. Only superusers can perform this action.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"LDAPProvider":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"LDAP Provider ID"},"name":{"type":"string","maxLength":256,"description":"Name of the LDAP provider."},"slug":{"type":"string","maxLength":256,"description":"Unique slug for the LDAP provider."},"icon":{"type":"string","format":"binary","description":"Icon for the LDAP provider."},"host":{"type":"string","format":"url","description":"Host URL for the LDAP provider."},"port":{"type":"integer","description":"Port number to connect to the LDAP server.","maximum":65535},"use_ssl":{"type":"boolean","description":"Indicates whether SSL is used for the LDAP connection."},"bind_dn":{"type":"string","maxLength":256,"description":"The distinguished name (DN) for binding to the LDAP server."},"bind_password":{"type":"string","maxLength":512,"description":"Password for the LDAP bind user."},"base_dn":{"type":"string","maxLength":256,"description":"The base distinguished name (DN) for LDAP searches."},"attribute_map":{"type":"object","description":"A mapping of LDAP attributes to system fields."},"is_active":{"type":"boolean","description":"Indicates if the LDAP provider is active."}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"},"500":{"description":"Server Error"}}},"paths":{"/api/v1/ldap/":{"post":{"summary":"Create LDAP provider","description":"Create a new LDAP provider. Only superusers can perform this action.","tags":["LDAPProviders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LDAPProvider"}}},"description":"LDAP provider object to create."},"responses":{"201":{"description":"LDAP provider created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LDAPProvider"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Healthcheck

## Get health status of services from the Omnitron API

> Get health status of services from the Omnitron API

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"417":{"description":"Expectation Failed error code is only returned when the server or response chain does not support expectations."}}},"paths":{"/api/v1/healthcheck/":{"get":{"summary":"Get health status of services from the Omnitron API","description":"Get health status of services from the Omnitron API","tags":["Healthcheck"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"database":{"type":"object","properties":{"default":{"type":"object","properties":{"status":{"type":"string"}}}}},"cache":{"type":"object","properties":{"default":{"type":"object","properties":{"status":{"type":"string"}}}}}}}}}},"417":{"$ref":"#/components/responses/417"}}}}}}
```

## Checks health status of services from the Omnitron API

> Checks health status of services from the Omnitron API

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"204":{"description":"No content"},"417":{"description":"Expectation Failed error code is only returned when the server or response chain does not support expectations."}}},"paths":{"/api/v1/healthcheck/":{"head":{"summary":"Checks health status of services from the Omnitron API","description":"Checks health status of services from the Omnitron API","tags":["Healthcheck"],"responses":{"204":{"$ref":"#/components/responses/204"},"417":{"$ref":"#/components/responses/417"}}}}}}
```


# Loyalty Transactions

## Retrieve a loyalty transaction

> Retrieve detailed information for a specific loyalty transaction.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"LoyaltyTransaction":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"required":["uuid","amount","order","user_email","transaction_type","customer_email"],"properties":{"pk":{"type":"integer","description":"Primary key of the loyalty transaction"},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the loyalty transaction."},"amount":{"type":"number","format":"decimal","description":"Transaction amount."},"order":{"type":"integer","description":"ID of the associated order"},"user_email":{"type":"string","format":"email","description":"Email of the user who performed the transaction."},"transaction_type":{"$ref":"#/components/schemas/LoyaltyTransactionType"},"customer":{"$ref":"#/components/schemas/Customer"},"customer_email":{"type":"string","format":"email","description":"Email of the customer involved in the transaction."},"raw_request":{"type":"string","nullable":true,"description":"Raw request data (optional)."},"raw_response":{"type":"string","nullable":true,"description":"Raw response data (optional)."},"reference":{"type":"string","description":"Reference identifier for the transaction.","nullable":true},"remote_addr":{"type":"string","format":"ipv4","nullable":true,"description":"IP address from where the transaction was initiated."}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"LoyaltyTransactionType":{"type":"string","description":"Type of loyalty transaction","enum":["purchase","refund"]},"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/loyalty_transactions/{id}/":{"get":{"summary":"Retrieve a loyalty transaction","description":"Retrieve detailed information for a specific loyalty transaction.","tags":["LoyaltyTransactions"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Detailed information about the loyalty transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoyaltyTransaction"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve list of loyalty transactions

> Retrieve a paginated list of all loyalty transactions.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"uuid":{"name":"uuid","in":"query","description":"Filter by UUID.","required":false,"schema":{"type":"string"}},"transaction_type":{"name":"transaction_type","in":"query","description":"Filter by transaction type.","required":false,"schema":{"type":"string","enum":["purchase","refund"]}},"order":{"name":"order","in":"query","description":"Filter by order ID.","required":false,"schema":{"type":"number"}},"user_email":{"name":"user_email","in":"query","required":false,"schema":{"type":"string","format":"email"},"description":"User's email (case-insensitive)"},"customer_email":{"name":"customer_email","in":"query","required":false,"schema":{"type":"string","format":"email"},"description":"Customer's email (case-insensitive)"},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"reference":{"name":"reference","in":"query","description":"Filter by reference.","required":false,"schema":{"type":"string"}}},"schemas":{"LoyaltyTransaction":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"required":["uuid","amount","order","user_email","transaction_type","customer_email"],"properties":{"pk":{"type":"integer","description":"Primary key of the loyalty transaction"},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the loyalty transaction."},"amount":{"type":"number","format":"decimal","description":"Transaction amount."},"order":{"type":"integer","description":"ID of the associated order"},"user_email":{"type":"string","format":"email","description":"Email of the user who performed the transaction."},"transaction_type":{"$ref":"#/components/schemas/LoyaltyTransactionType"},"customer":{"$ref":"#/components/schemas/Customer"},"customer_email":{"type":"string","format":"email","description":"Email of the customer involved in the transaction."},"raw_request":{"type":"string","nullable":true,"description":"Raw request data (optional)."},"raw_response":{"type":"string","nullable":true,"description":"Raw response data (optional)."},"reference":{"type":"string","description":"Reference identifier for the transaction.","nullable":true},"remote_addr":{"type":"string","format":"ipv4","nullable":true,"description":"IP address from where the transaction was initiated."}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"LoyaltyTransactionType":{"type":"string","description":"Type of loyalty transaction","enum":["purchase","refund"]},"Customer":{"type":"object","properties":{"pk":{"format":"int64","readOnly":true,"description":"Customer ID"},"email":{"type":"string","format":"email","description":"Email address of the customer"},"first_name":{"type":"string","description":"First name of the customer","maxLength":255},"last_name":{"type":"string","description":"Last name of the customer","maxLength":255},"phone_number":{"type":"string","description":"Phone number of the customer","nullable":true,"maxLength":128},"is_active":{"type":"boolean","description":"Indicates if the customer is active","default":false},"channel_code":{"type":"string","description":"Code representing the channel the customer belongs to","maxLength":64},"erp_code":{"type":"string","description":"Partner customer code (ERP code)","nullable":true,"maxLength":64},"attributes":{"type":"object","description":"Attributes as a JSON object"},"attribute_kwargs":{"type":"object","description":"Attribute kwargs as a JSON object"},"localized_attributes":{"type":"object","description":"Localized attributes as a JSON object"},"localized_attribute_kwargs":{"type":"object","description":"Localized attribute kwargs as a JSON object"},"extra_field":{"type":"object","description":"Additional fields as a JSON object"},"email_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving emails"},"sms_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving SMS"},"call_allowed":{"type":"boolean","description":"Indicates if the customer allows receiving calls"},"date_joined":{"type":"string","format":"date-time","description":"The date when the customer joined","nullable":true},"gender":{"type":"string","description":"Gender of the customer","nullable":true,"enum":["male","female"]},"user_type":{"type":"string","description":"Type of user","nullable":true,"enum":["guest","registered"]},"date_of_birth":{"type":"string","format":"date","description":"Date of birth of the customer","nullable":true},"channel":{"type":"integer","nullable":true,"description":"ID of the channel the customer belongs to"}},"required":["email","channel_code","is_active","email_allowed","sms_allowed","call_allowed"]}},"responses":{"500":{"description":"Server Error"}}},"paths":{"/api/v1/loyalty_transactions/":{"get":{"summary":"Retrieve list of loyalty transactions","description":"Retrieve a paginated list of all loyalty transactions.","tags":["LoyaltyTransactions"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/uuid"},{"$ref":"#/components/parameters/transaction_type"},{"$ref":"#/components/parameters/order"},{"$ref":"#/components/parameters/user_email"},{"$ref":"#/components/parameters/customer_email"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/modified_date"},{"$ref":"#/components/parameters/reference"}],"responses":{"200":{"description":"A paginated list of loyalty transactions.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LoyaltyTransaction"}}}}},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Policies

## Retrieve Policy

> Get details of a specific policy by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Policy":{"type":"object","properties":{"id":{"type":"integer","description":"Policy ID","readOnly":true},"users":{"type":"array","items":{"type":"integer"},"description":"List of users associated with the policy."},"fe_permission_groups":{"type":"array","items":{"type":"integer"},"description":"List of frontend permission groups associated with the policy."},"accept_languages":{"type":"array","items":{"type":"string","maxLength":10},"description":"List of accepted language codes. If empty, all languages are accepted."},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"}}}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/policies/{id}/":{"get":{"summary":"Retrieve Policy","description":"Get details of a specific policy by ID.","tags":["Policies"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Policy details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Update Policy

> Update the details of an existing policy.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Policy":{"type":"object","properties":{"id":{"type":"integer","description":"Policy ID","readOnly":true},"users":{"type":"array","items":{"type":"integer"},"description":"List of users associated with the policy."},"fe_permission_groups":{"type":"array","items":{"type":"integer"},"description":"List of frontend permission groups associated with the policy."},"accept_languages":{"type":"array","items":{"type":"string","maxLength":10},"description":"List of accepted language codes. If empty, all languages are accepted."},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"}}}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/policies/{id}/":{"put":{"summary":"Update Policy","description":"Update the details of an existing policy.","tags":["Policies"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"responses":{"200":{"description":"The policy was successfully updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Delete Policy

> Delete a specific policy by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/policies/{id}/":{"delete":{"summary":"Delete Policy","description":"Delete a specific policy by ID.","tags":["Policies"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"The policy was successfully deleted."},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## List Policies

> Retrieve a list of policies with optional filtering.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"name":{"name":"name","in":"query","description":"Filter by name.","schema":{"type":"string"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"users":{"name":"users","in":"query","required":false,"description":"Filter by user IDs associated with the policy.","schema":{"type":"array","items":{"type":"integer"}}},"fe_permission_groups":{"name":"fe_permission_groups","in":"query","required":false,"description":"Filter by frontend permission group IDs associated with the policy.","schema":{"type":"array","items":{"type":"integer"}}}},"schemas":{"Policy":{"type":"object","properties":{"id":{"type":"integer","description":"Policy ID","readOnly":true},"users":{"type":"array","items":{"type":"integer"},"description":"List of users associated with the policy."},"fe_permission_groups":{"type":"array","items":{"type":"integer"},"description":"List of frontend permission groups associated with the policy."},"accept_languages":{"type":"array","items":{"type":"string","maxLength":10},"description":"List of accepted language codes. If empty, all languages are accepted."},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"}}}},"responses":{"403":{"description":"Forbidden"}}},"paths":{"/api/v1/policies/":{"get":{"summary":"List Policies","description":"Retrieve a list of policies with optional filtering.","tags":["Policies"],"parameters":[{"$ref":"#/components/parameters/name"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/modified_date"},{"$ref":"#/components/parameters/users"},{"$ref":"#/components/parameters/fe_permission_groups"}],"responses":{"200":{"description":"A list of policies.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Policy"}}}}},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Create Policy

> Create a new policy.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Policy":{"type":"object","properties":{"id":{"type":"integer","description":"Policy ID","readOnly":true},"users":{"type":"array","items":{"type":"integer"},"description":"List of users associated with the policy."},"fe_permission_groups":{"type":"array","items":{"type":"integer"},"description":"List of frontend permission groups associated with the policy."},"accept_languages":{"type":"array","items":{"type":"string","maxLength":10},"description":"List of accepted language codes. If empty, all languages are accepted."},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/policies/":{"post":{"summary":"Create Policy","description":"Create a new policy.","tags":["Policies"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"responses":{"201":{"description":"The policy was successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Policy"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```


# Sorting Algorithm

## Retrieve Sorting Algorithm

> Retrieve a specific sorting algorithm by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"SortingAlgorithm":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","format":"int64","readOnly":true,"description":"Sorting algorithm object ID."},"catalog":{"type":"integer","description":"Related catalog object ID."},"code":{"type":"string","maxLength":64,"description":"The code of the sorting algorithm."},"name":{"type":"string","maxLength":255,"description":"The name of the sorting algorithm."},"sorting_type":{"type":"string","description":"The type of sorting algorithm.","enum":["static","dynamic","external"]},"ruleset":{"type":"object","description":"A JSON object containing the ruleset for the sorting algorithm."},"config":{"type":"object","description":"A JSON object containing the configuration for the sorting algorithm."},"is_visible":{"type":"boolean","description":"Indicates whether this sorting algorithm is visible.","default":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/{id}/":{"get":{"summary":"Retrieve Sorting Algorithm","description":"Retrieve a specific sorting algorithm by ID","tags":["SortingAlgorithm"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Sorting Algorithm retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/SortingAlgorithm"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Sorting Algorithm

> Update a specific sorting algorithm by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"SortingAlgorithm":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","format":"int64","readOnly":true,"description":"Sorting algorithm object ID."},"catalog":{"type":"integer","description":"Related catalog object ID."},"code":{"type":"string","maxLength":64,"description":"The code of the sorting algorithm."},"name":{"type":"string","maxLength":255,"description":"The name of the sorting algorithm."},"sorting_type":{"type":"string","description":"The type of sorting algorithm.","enum":["static","dynamic","external"]},"ruleset":{"type":"object","description":"A JSON object containing the ruleset for the sorting algorithm."},"config":{"type":"object","description":"A JSON object containing the configuration for the sorting algorithm."},"is_visible":{"type":"boolean","description":"Indicates whether this sorting algorithm is visible.","default":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/{id}/":{"put":{"summary":"Update Sorting Algorithm","description":"Update a specific sorting algorithm by ID","tags":["SortingAlgorithm"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SortingAlgorithm"}}}},"responses":{"200":{"description":"Sorting Algorithm updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Sorting Algorithm

> Delete a specific Sorting Algorithm by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/{id}/":{"delete":{"summary":"Delete Sorting Algorithm","description":"Delete a specific Sorting Algorithm by ID","tags":["SortingAlgorithm"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Sorting Algorithm deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update Sorting Algorithm

> Partial update a specific sorting algorithm by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"SortingAlgorithm":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","format":"int64","readOnly":true,"description":"Sorting algorithm object ID."},"catalog":{"type":"integer","description":"Related catalog object ID."},"code":{"type":"string","maxLength":64,"description":"The code of the sorting algorithm."},"name":{"type":"string","maxLength":255,"description":"The name of the sorting algorithm."},"sorting_type":{"type":"string","description":"The type of sorting algorithm.","enum":["static","dynamic","external"]},"ruleset":{"type":"object","description":"A JSON object containing the ruleset for the sorting algorithm."},"config":{"type":"object","description":"A JSON object containing the configuration for the sorting algorithm."},"is_visible":{"type":"boolean","description":"Indicates whether this sorting algorithm is visible.","default":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/{id}/":{"patch":{"summary":"Partial Update Sorting Algorithm","description":"Partial update a specific sorting algorithm by ID","tags":["SortingAlgorithm"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SortingAlgorithm"}}}},"responses":{"200":{"description":"Sorting Algorithm updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Sorting Algorithm

> List Sorting Algorithm

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"id":{"name":"id","in":"query","required":false,"description":"Filters by id","schema":{"type":"integer"}},"pk":{"name":"pk","in":"query","required":false,"description":"Filters by primary key","schema":{"type":"integer"}},"pk__gt":{"name":"pk__gt","in":"query","description":"Filter by primary key greater than a specific value.","schema":{"type":"string"}},"pk__gte":{"name":"pk__gte","in":"query","required":false,"description":"Filters by primary key greater than or equal to the given value","schema":{"type":"integer"}},"pk__lt":{"name":"pk__lt","in":"query","required":false,"description":"Filters by primary key less than the given value","schema":{"type":"integer"}},"pk__lte":{"name":"pk__lte","in":"query","required":false,"description":"Filters by primary key less than or equal to the given value","schema":{"type":"integer"}},"sorting_type":{"name":"sorting_type","in":"query","description":"The type of sorting algorithm.","required":false,"schema":{"type":"string","enum":["static","dynamic","external"]}},"ruleset":{"name":"ruleset","in":"query","description":"A JSON object containing the ruleset for the sorting algorithm.","required":false,"schema":{"type":"object"}},"config":{"name":"config","in":"query","description":"A JSON object containing the configuration for the sorting algorithm.","required":false,"schema":{"type":"object"}},"catalog_id":{"name":"catalog_id","in":"query","description":"Filter by catalog ID.","required":false,"schema":{"type":"integer"}},"code":{"name":"code","in":"query","description":"Filter by code.","required":false,"schema":{"type":"string"}},"name":{"name":"name","in":"query","description":"Filter by name.","schema":{"type":"string"}},"is_visible":{"name":"is_visible","in":"query","description":"Indicates whether this sorting algorithm is visible.","required":false,"schema":{"type":"boolean"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}}},"schemas":{"SortingAlgorithm":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","format":"int64","readOnly":true,"description":"Sorting algorithm object ID."},"catalog":{"type":"integer","description":"Related catalog object ID."},"code":{"type":"string","maxLength":64,"description":"The code of the sorting algorithm."},"name":{"type":"string","maxLength":255,"description":"The name of the sorting algorithm."},"sorting_type":{"type":"string","description":"The type of sorting algorithm.","enum":["static","dynamic","external"]},"ruleset":{"type":"object","description":"A JSON object containing the ruleset for the sorting algorithm."},"config":{"type":"object","description":"A JSON object containing the configuration for the sorting algorithm."},"is_visible":{"type":"boolean","description":"Indicates whether this sorting algorithm is visible.","default":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/":{"get":{"summary":"List Sorting Algorithm","description":"List Sorting Algorithm","tags":["SortingAlgorithm"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/id"},{"$ref":"#/components/parameters/pk"},{"$ref":"#/components/parameters/pk__gt"},{"$ref":"#/components/parameters/pk__gte"},{"$ref":"#/components/parameters/pk__lt"},{"$ref":"#/components/parameters/pk__lte"},{"$ref":"#/components/parameters/sorting_type"},{"$ref":"#/components/parameters/ruleset"},{"$ref":"#/components/parameters/config"},{"$ref":"#/components/parameters/catalog_id"},{"$ref":"#/components/parameters/code"},{"$ref":"#/components/parameters/name"},{"$ref":"#/components/parameters/is_visible"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/modified_date"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/SortingAlgorithm"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create Sorting Algorithm

> Create a new sorting algorithm.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"SortingAlgorithm":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","format":"int64","readOnly":true,"description":"Sorting algorithm object ID."},"catalog":{"type":"integer","description":"Related catalog object ID."},"code":{"type":"string","maxLength":64,"description":"The code of the sorting algorithm."},"name":{"type":"string","maxLength":255,"description":"The name of the sorting algorithm."},"sorting_type":{"type":"string","description":"The type of sorting algorithm.","enum":["static","dynamic","external"]},"ruleset":{"type":"object","description":"A JSON object containing the ruleset for the sorting algorithm."},"config":{"type":"object","description":"A JSON object containing the configuration for the sorting algorithm."},"is_visible":{"type":"boolean","description":"Indicates whether this sorting algorithm is visible.","default":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/sorting_algorithms/":{"post":{"summary":"Create Sorting Algorithm","description":"Create a new sorting algorithm.","tags":["SortingAlgorithm"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SortingAlgorithm"}}}},"responses":{"201":{"description":"Sorting Algorithm Created","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/SortingAlgorithm"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Exports

## Retrieve an export

> Get details of a specific export record by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Export":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true,"description":"Unique identifier for the export."},"action_name":{"type":"string","nullable":true,"maxLength":255,"description":"Name of the export action."},"collected_count":{"type":"integer","format":"int32","default":0,"description":"Number of records collected for the export."},"error_message":{"type":"string","nullable":true},"fail_count":{"type":"integer","format":"int32","default":0,"description":"Number of records that failed to export."},"filter_file":{"type":"string","format":"binary","nullable":true,"description":"Path to the uploaded filter file."},"format_type":{"type":"string","enum":["csv","xls","json"],"default":"csv","description":"File format for the export."},"language":{"type":"string","maxLength":8,"description":"Language code for the export."},"last_instance_id":{"type":"integer","format":"int32","default":0,"description":"ID of the last record exported."},"page":{"type":"integer","format":"int32","default":1,"description":"Current page number for the export."},"request_fields":{"type":"array","items":{"type":"string"},"description":"List of fields requested for the export."},"request_path":{"type":"string","description":"API path to request data for the export."},"requested_by":{"type":"string","format":"uuid","description":"ID of the user who requested the export."},"result_file":{"type":"string","nullable":true,"maxLength":512,"description":"Path or URL to the result file."},"total_count":{"type":"integer","format":"int32","default":0,"description":"Total number of records to be exported."},"status":{"type":"string","enum":["waiting","waiting_next_page","processing","completed","failed","cancelled","preparing_file_creation"],"default":"waiting"},"uploaded_parts":{"type":"array","items":{"type":"string"},"description":"List of uploaded file parts."},"viewset":{"type":"string","nullable":true,"maxLength":255,"description":"The name of the viewset associated with the export."},"created_date":{"type":"string","format":"date-time","description":"Creation Date"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date"}}}},"responses":{"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/exports/{id}/":{"get":{"summary":"Retrieve an export","description":"Get details of a specific export record by ID.","tags":["Exports"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Export details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Export"}}}},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## List exports

> Retrieve a list of export records with optional filtering. Non-superusers can only see their own records.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"status":{"name":"status","in":"query","required":false,"description":"Filter by the export status.","schema":{"type":"string","enum":["pending","processing","completed","failed"]}},"format_type":{"name":"format_type","in":"query","required":false,"description":"Filter by the export file format.","schema":{"type":"string","enum":["csv","json","xml"]}}},"schemas":{"Export":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true,"description":"Unique identifier for the export."},"action_name":{"type":"string","nullable":true,"maxLength":255,"description":"Name of the export action."},"collected_count":{"type":"integer","format":"int32","default":0,"description":"Number of records collected for the export."},"error_message":{"type":"string","nullable":true},"fail_count":{"type":"integer","format":"int32","default":0,"description":"Number of records that failed to export."},"filter_file":{"type":"string","format":"binary","nullable":true,"description":"Path to the uploaded filter file."},"format_type":{"type":"string","enum":["csv","xls","json"],"default":"csv","description":"File format for the export."},"language":{"type":"string","maxLength":8,"description":"Language code for the export."},"last_instance_id":{"type":"integer","format":"int32","default":0,"description":"ID of the last record exported."},"page":{"type":"integer","format":"int32","default":1,"description":"Current page number for the export."},"request_fields":{"type":"array","items":{"type":"string"},"description":"List of fields requested for the export."},"request_path":{"type":"string","description":"API path to request data for the export."},"requested_by":{"type":"string","format":"uuid","description":"ID of the user who requested the export."},"result_file":{"type":"string","nullable":true,"maxLength":512,"description":"Path or URL to the result file."},"total_count":{"type":"integer","format":"int32","default":0,"description":"Total number of records to be exported."},"status":{"type":"string","enum":["waiting","waiting_next_page","processing","completed","failed","cancelled","preparing_file_creation"],"default":"waiting"},"uploaded_parts":{"type":"array","items":{"type":"string"},"description":"List of uploaded file parts."},"viewset":{"type":"string","nullable":true,"maxLength":255,"description":"The name of the viewset associated with the export."},"created_date":{"type":"string","format":"date-time","description":"Creation Date"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date"}}}},"responses":{"403":{"description":"Forbidden"}}},"paths":{"/api/v1/exports/":{"get":{"summary":"List exports","description":"Retrieve a list of export records with optional filtering. Non-superusers can only see their own records.","tags":["Exports"],"parameters":[{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/status"},{"$ref":"#/components/parameters/format_type"}],"responses":{"200":{"description":"A list of exports.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Export"}}}}},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Set export as cancelled

> Mark an export record as cancelled. Only accessible by superusers.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Export":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true,"description":"Unique identifier for the export."},"action_name":{"type":"string","nullable":true,"maxLength":255,"description":"Name of the export action."},"collected_count":{"type":"integer","format":"int32","default":0,"description":"Number of records collected for the export."},"error_message":{"type":"string","nullable":true},"fail_count":{"type":"integer","format":"int32","default":0,"description":"Number of records that failed to export."},"filter_file":{"type":"string","format":"binary","nullable":true,"description":"Path to the uploaded filter file."},"format_type":{"type":"string","enum":["csv","xls","json"],"default":"csv","description":"File format for the export."},"language":{"type":"string","maxLength":8,"description":"Language code for the export."},"last_instance_id":{"type":"integer","format":"int32","default":0,"description":"ID of the last record exported."},"page":{"type":"integer","format":"int32","default":1,"description":"Current page number for the export."},"request_fields":{"type":"array","items":{"type":"string"},"description":"List of fields requested for the export."},"request_path":{"type":"string","description":"API path to request data for the export."},"requested_by":{"type":"string","format":"uuid","description":"ID of the user who requested the export."},"result_file":{"type":"string","nullable":true,"maxLength":512,"description":"Path or URL to the result file."},"total_count":{"type":"integer","format":"int32","default":0,"description":"Total number of records to be exported."},"status":{"type":"string","enum":["waiting","waiting_next_page","processing","completed","failed","cancelled","preparing_file_creation"],"default":"waiting"},"uploaded_parts":{"type":"array","items":{"type":"string"},"description":"List of uploaded file parts."},"viewset":{"type":"string","nullable":true,"maxLength":255,"description":"The name of the viewset associated with the export."},"created_date":{"type":"string","format":"date-time","description":"Creation Date"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date"}}}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/exports/{id}/set_cancel/":{"post":{"summary":"Set export as cancelled","description":"Mark an export record as cancelled. Only accessible by superusers.","tags":["Exports"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Export successfully cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Export"}}}},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```


# Dashboard

## Get chart data

> Fetches chart data for visualization.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/chart/":{"get":{"summary":"Get chart data","description":"Fetches chart data for visualization.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved chart data.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"count":{"type":"integer","description":"Count of orders."},"time":{"type":"string","description":"Time representation for the chart. Hour of the day."}}}}}}}}}}}}
```

## Get top cities

> Retrieves a list of cities with the highest order volumes.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/top_cities/":{"get":{"summary":"Get top cities","description":"Retrieves a list of cities with the highest order volumes.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved top cities.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"City name."},"item_count":{"type":"integer","description":"Number of items sold in the city."},"city_count":{"type":"integer","description":"Number of orders in the city."},"price":{"type":"number","format":"float","description":"Total sales amount for the city."}}}}}}}}}}}}
```

## Get top categories

> Retrieves a list of top-selling categories.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/top_categories/":{"get":{"summary":"Get top categories","description":"Retrieves a list of top-selling categories.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved top categories.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"pk":{"type":"integer","description":"ProductCategory ID."},"name":{"type":"string","description":"Category name."},"item_count":{"type":"integer","description":"Total number of sales for the category."},"price":{"type":"number","format":"float","description":"Total sales amount for the category."}}}}}}}}}}}}
```

## Get product details

> Retrieves total product count and stock for the given channel.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/":{"get":{"summary":"Get product details","description":"Retrieves total product count and stock for the given channel.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved product details.","content":{"application/json":{"schema":{"type":"object","properties":{"total_product_count":{"type":"integer"},"total_product_stocks":{"type":"integer"}}}}}}}}}}}
```

## Get products sales data.

> Fetches a list of products sale data for a given period.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/orders_by_product/":{"get":{"summary":"Get products sales data.","description":"Fetches a list of products sale data for a given period.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved products sale data.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"sold":{"type":"integer","description":"Total number of products sold."},"total":{"type":"number","format":"float","description":"Total sales amount."},"stock":{"type":"integer","description":"Total stock."},"base_code":{"type":"string","description":"Product base code."},"sku":{"type":"string","description":"Product SKU."},"name":{"type":"string","description":"Product name."},"channel":{"type":"string","description":"Channel name."}}}}}}}}}}}}
```

## Get top products

> Fetches a list of top products based on sales or quantity.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/top_products/":{"get":{"summary":"Get top products","description":"Fetches a list of top products based on sales or quantity.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved top products.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orderitem__product":{"type":"integer","description":"Product ID."},"product_count":{"type":"integer","description":"Total quantity sold."},"price":{"type":"number","format":"float","description":"Total sales amount."},"name":{"type":"string","description":"Product name."}}}}}}}}}}}}
```

## Get overall data

> Fetches overall dashboard data such as turnover, sales, and refunds.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"start_date":{"name":"start_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start date for the data range."},"end_date":{"name":"end_date","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End date for the data range."},"channel":{"name":"channel","in":"query","description":"ID of the channel the customer belongs to","required":false,"schema":{"type":"integer"}},"payment_option_slug":{"name":"payment_option_slug","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by payment option slug."}}},"paths":{"/api/v1/dashboard/overall_data/":{"get":{"summary":"Get overall data","description":"Fetches overall dashboard data such as turnover, sales, and refunds.","tags":["Dashboard"],"parameters":[{"$ref":"#/components/parameters/start_date","required":true},{"$ref":"#/components/parameters/end_date","required":true},{"$ref":"#/components/parameters/channel","required":true},{"$ref":"#/components/parameters/payment_option_slug"}],"responses":{"200":{"description":"Successfully retrieved overall data.","content":{"application/json":{"schema":{"type":"object","properties":{"turnover":{"type":"number","format":"float"},"total_order_quantity":{"type":"integer"},"total_orderitem_quantity":{"type":"integer"},"average_sale_price":{"type":"number","format":"float"},"average_basket_price":{"type":"number","format":"float"},"total_shipping_amount":{"type":"number","format":"float"},"total_discount":{"type":"number","format":"float"},"updated_at":{"type":"string","format":"date-time"},"total_sale_amount":{"type":"number","format":"float"},"total_refund_amount":{"type":"number","format":"float"},"total_cancel_amount":{"type":"number","format":"float"},"total_cancel_quantity":{"type":"integer"},"total_refund_quantity":{"type":"integer"},"currency_type":{"type":"string","enum":["TL","EUR","USD","EGP","GBP","MAD","PLN","SAR","RON","UAH","CZK","HUF","RUB","BGN","IQD","KWD","BHD","OMR","QAR","AED","NGN","INR","LEI","KZT","JOD","RSD"]}}}}}}}}}}}
```


# Product Collections

## Retrieve Product Collection

> Retrieve a specific product collection by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/{id}/":{"get":{"summary":"Retrieve Product Collection","description":"Retrieve a specific product collection by ID","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/id_path"},{"$ref":"#/components/parameters/hyper"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductCollection"},{"$ref":"#/components/schemas/ProductCollectionHyperSerializer"}]}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Product Collection

> Update an existing product collection

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/{id}/":{"put":{"summary":"Update Product Collection","description":"Update an existing product collection","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/id_path"},{"$ref":"#/components/parameters/hyper"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","collection_type","catalog"],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection"},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductCollection"},{"$ref":"#/components/schemas/ProductCollectionHyperSerializer"}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Product Collection

> Delete an existing product collection

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/{id}/":{"delete":{"summary":"Delete Product Collection","description":"Delete an existing product collection","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"No Content"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update Product Collection

> Partially update an existing product collection

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/{id}/":{"patch":{"summary":"Partial Update Product Collection","description":"Partially update an existing product collection","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/id_path"},{"$ref":"#/components/parameters/hyper"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection"},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"is_active":{"type":"boolean","description":"Whether the product collection is active"},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductCollection"},{"$ref":"#/components/schemas/ProductCollectionHyperSerializer"}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve Detailed Product Collection

> Retrieve a specific product collection with detailed information

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollectionDetailedSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"catalog":{"type":"object","description":"Catalog object"},"sort_option":{"type":"object","description":"Sort option object"}}},"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionDetailedHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/{id}/detailed/":{"get":{"summary":"Retrieve Detailed Product Collection","description":"Retrieve a specific product collection with detailed information","tags":["Product Collections"],"parameters":[{"name":"id","in":"path","required":true,"description":"A unique integer value identifying this product collection.","schema":{"type":"integer"}},{"$ref":"#/components/parameters/hyper"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"},{"$ref":"#/components/schemas/ProductCollectionDetailedHyperSerializer"}]}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Product Collections

> List all product collections

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/":{"get":{"summary":"List Product Collections","description":"List all product collections","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/hyper"},{"name":"catalog","in":"query","description":"Filter by catalog ID","schema":{"type":"integer"}},{"name":"collection_type","in":"query","description":"Filter by collection type","schema":{"type":"string","enum":["static","dynamic"]}},{"name":"expiration_date__gt","in":"query","description":"Filter by expiration date greater than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__gte","in":"query","description":"Filter by expiration date greater than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lt","in":"query","description":"Filter by expiration date less than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lte","in":"query","description":"Filter by expiration date less than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__isnull","in":"query","description":"Filter by whether expiration date is null","schema":{"type":"boolean"}},{"name":"pk__in","in":"query","description":"Filter by multiple IDs (comma-separated)","schema":{"type":"string"}},{"name":"is_active","in":"query","description":"Filter by active status","schema":{"type":"boolean"}},{"name":"name","in":"query","description":"Filter by name","schema":{"type":"string"}},{"name":"slug","in":"query","description":"Filter by slug","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/ProductCollection"},{"$ref":"#/components/schemas/ProductCollectionHyperSerializer"}]}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create Product Collection

> Create a new product collection

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/":{"post":{"summary":"Create Product Collection","description":"Create a new product collection","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/hyper"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","collection_type","catalog"],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection"},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProductCollection"},{"$ref":"#/components/schemas/ProductCollectionHyperSerializer"}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Product Collections with details

> List product collections with detailed information

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollectionDetailedSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"catalog":{"type":"object","description":"Catalog object"},"sort_option":{"type":"object","description":"Sort option object"}}},"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionDetailedHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/detailed/":{"get":{"summary":"List Product Collections with details","description":"List product collections with detailed information","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/hyper"},{"name":"catalog","in":"query","description":"Filter by catalog ID","schema":{"type":"integer"}},{"name":"collection_type","in":"query","description":"Filter by collection type","schema":{"type":"string","enum":["static","dynamic"]}},{"name":"expiration_date__gt","in":"query","description":"Filter by expiration date greater than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__gte","in":"query","description":"Filter by expiration date greater than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lt","in":"query","description":"Filter by expiration date less than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lte","in":"query","description":"Filter by expiration date less than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__isnull","in":"query","description":"Filter by whether expiration date is null","schema":{"type":"boolean"}},{"name":"pk__in","in":"query","description":"Filter by multiple IDs (comma-separated)","schema":{"type":"string"}},{"name":"is_active","in":"query","description":"Filter by active status","schema":{"type":"boolean"}},{"name":"name","in":"query","description":"Filter by name","schema":{"type":"string"}},{"name":"slug","in":"query","description":"Filter by slug","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"},{"$ref":"#/components/schemas/ProductCollectionDetailedHyperSerializer"}]}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Product Collections with details (detailed\_list action)

> List product collections with detailed information using the detailed\_list action

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"ProductCollectionDetailedSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollection"}],"properties":{"catalog":{"type":"object","description":"Catalog object"},"sort_option":{"type":"object","description":"Sort option object"}}},"ProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/BaseProductCollection"},{"$ref":"#/components/schemas/IntegrationRelation"}],"properties":{"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product collection"},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":false},"catalog":{"type":"integer","description":"Foreign key to Catalog model"},"kwargs":{"type":"object","description":"Dynamic configuration stored as JSON","additionalProperties":true},"value_dict":{"type":"object","description":"Dictionary of filter values for dynamic collections","additionalProperties":true},"selected_filters":{"type":"array","description":"List of selected filters for the collection","items":{"type":"string"}},"is_dynamic":{"type":"boolean","description":"Whether the collection is dynamic","readOnly":true}}},"BaseProductCollection":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"name":{"type":"string","description":"Name of the product collection","maxLength":255},"slug":{"type":"string","description":"Unique slug identifier for the product collection","maxLength":255},"is_active":{"type":"boolean","description":"Whether the product collection is active","default":true},"sort_option":{"type":"integer","description":"Foreign key to SortOption model","nullable":true},"expiration_date":{"type":"string","format":"date-time","description":"Date and time when the collection expires","nullable":true},"collection_type":{"type":"string","enum":["static","dynamic"],"description":"Type of the product collection","nullable":true}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"IntegrationRelation":{"type":"object","properties":{"integration":{"type":"array","description":"Integration actions associated with the object.","items":{"$ref":"#/components/schemas/IntegrationAction"}}}},"IntegrationAction":{"type":"object","properties":{"channel":{"$ref":"#/components/schemas/Channel"},"content_type":{"$ref":"#/components/schemas/ContentType"},"object_id":{"type":"integer","description":"ID of the related object (used with GenericForeignKey)"},"remote_id":{"type":"string","maxLength":255,"nullable":true},"version_date":{"type":"string","format":"date-time","description":"The version date of the action"},"state":{"type":"object","description":"JSON representation of the state"},"local_batch_id":{"type":"string","maxLength":255,"nullable":true},"status":{"$ref":"#/components/schemas/IntegrationActionStatus"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"}}},"Channel":{"type":"object","required":["name","catalog","channel_type","conf","is_active"],"properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":255},"catalog":{"type":"integer"},"channel_type":{"type":"string","description":"The type of channel. ex: web, distributed, hepsiburada, etc.","enum":["hepsiburada","hepsiburadads","gittigidiyor","n11","web","feed","trendyol","morhipo","morhipoV2","lidyana","amazon","allegro","distributed","aliexpress","emag","ciceksepeti","gordumaldim","pazarama","flo","turkcellds","sales_channel"]},"conf":{"type":"object","description":"A JSON object containing configuration settings for the channel.","additionalProperties":{"type":"string"}},"category_tree":{"type":"string","nullable":true,"description":"The category tree related to this channel."},"is_active":{"type":"boolean","description":"Specifies whether the channel is active.","default":true},"schema":{"type":"object","description":"Additional schema information for the channel.","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true},"modified_date":{"type":"string","format":"date-time"}}},"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]},"IntegrationActionStatus":{"type":"string","enum":["processing","success","error"],"description":"Status of the integration action"},"ProductCollectionDetailedHyperSerializer":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"}],"properties":{"url":{"type":"string","format":"uri","description":"URL for the product collection"},"catalog":{"type":"string","format":"uri","description":"URL for the catalog"},"sort_option":{"type":"string","format":"uri","description":"URL for the sort option","nullable":true}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/product_collections/detailed_list/":{"get":{"summary":"List Product Collections with details (detailed_list action)","description":"List product collections with detailed information using the detailed_list action","tags":["Product Collections"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/hyper"},{"name":"catalog","in":"query","description":"Filter by catalog ID","schema":{"type":"integer"}},{"name":"collection_type","in":"query","description":"Filter by collection type","schema":{"type":"string","enum":["static","dynamic"]}},{"name":"expiration_date__gt","in":"query","description":"Filter by expiration date greater than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__gte","in":"query","description":"Filter by expiration date greater than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lt","in":"query","description":"Filter by expiration date less than","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__lte","in":"query","description":"Filter by expiration date less than or equal to","schema":{"type":"string","format":"date-time"}},{"name":"expiration_date__isnull","in":"query","description":"Filter by whether expiration date is null","schema":{"type":"boolean"}},{"name":"pk__in","in":"query","description":"Filter by multiple IDs (comma-separated)","schema":{"type":"string"}},{"name":"is_active","in":"query","description":"Filter by active status","schema":{"type":"boolean"}},{"name":"name","in":"query","description":"Filter by name","schema":{"type":"string"}},{"name":"slug","in":"query","description":"Filter by slug","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/ProductCollectionDetailedSerializer"},{"$ref":"#/components/schemas/ProductCollectionDetailedHyperSerializer"}]}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Auth TOTP

## Verify TOTP

> Verify TOTP code and complete the login process. This endpoint is used after initial login when TOTP is required.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPVerify":{"type":"object","required":["temp_token","token"],"properties":{"temp_token":{"type":"string","description":"Temporary token received from initial login"},"token":{"type":"string","description":"TOTP verification code"}}},"TOTPVerifyResponse":{"type":"object","properties":{"key":{"type":"string","description":"Login token"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/verify/":{"post":{"summary":"Verify TOTP","description":"Verify TOTP code and complete the login process. This endpoint is used after initial login when TOTP is required.","tags":["AuthTOTP"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPVerify"}}}},"responses":{"200":{"description":"The TOTP verification was successful and login is completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPVerifyResponse"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Setup TOTP

> Setup TOTP authentication.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPSetup":{"type":"object","properties":{"secret_key":{"type":"string","description":"TOTP secret key"},"provisioning_uri":{"type":"string","description":"TOTP provisioning URI"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/setup/":{"post":{"summary":"Setup TOTP","description":"Setup TOTP authentication.","tags":["AuthTOTP"],"responses":{"201":{"description":"The TOTP setup was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPSetup"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Activate TOTP

> Activate TOTP authentication by verifying the TOTP code.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"TOTPActivate":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"TOTP verification code"}}},"TOTPActivateResponse":{"type":"object","properties":{"recovery_codes":{"type":"array","description":"Recovery codes","items":{"type":"string"}}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/activate/":{"post":{"summary":"Activate TOTP","description":"Activate TOTP authentication by verifying the TOTP code.","tags":["AuthTOTP"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPActivate"}}}},"responses":{"200":{"description":"The TOTP activation was successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TOTPActivateResponse"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```

## Deactivate TOTP

> Deactivate TOTP authentication for the current user.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/auth/totp/deactivate/":{"post":{"summary":"Deactivate TOTP","description":"Deactivate TOTP authentication for the current user.","tags":["AuthTOTP"],"responses":{"200":{"description":"The TOTP deactivation was successful."},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```


# Price Lists

## Retrieve a price list

> Retrieve the details of a specific price list by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/price_list/{id}/":{"get":{"summary":"Retrieve a price list","description":"Retrieve the details of a specific price list by ID.","tags":["Price Lists"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Price list retrieved successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Update a price list

> Update the details of a specific price list by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/price_list/{id}/":{"put":{"summary":"Update a price list","description":"Update the details of a specific price list by ID.","tags":["Price Lists"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"responses":{"200":{"description":"Price list updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Delete a price list

> Delete a specific price list by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"204":{"description":"No content"},"403":{"description":"Forbidden"},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/price_list/{id}/":{"delete":{"summary":"Delete a price list","description":"Delete a specific price list by ID.","tags":["Price Lists"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## List price lists

> Retrieve a list of price lists with optional filtering.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"name":{"name":"name","in":"query","description":"Filter by name.","schema":{"type":"string"}},"code":{"name":"code","in":"query","description":"Filter by code.","required":false,"schema":{"type":"string"}},"code__exact":{"name":"code__exact","in":"query","required":false,"description":"Filters by exact code","schema":{"type":"string"}},"is_auto_sync":{"name":"is_auto_sync","in":"query","required":false,"description":"Filter by auto-sync status.","schema":{"type":"boolean"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}}},"schemas":{"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}}},"paths":{"/api/v1/price_list/":{"get":{"summary":"List price lists","description":"Retrieve a list of price lists with optional filtering.","tags":["Price Lists"],"parameters":[{"$ref":"#/components/parameters/name"},{"$ref":"#/components/parameters/code"},{"$ref":"#/components/parameters/code__exact"},{"$ref":"#/components/parameters/is_auto_sync"},{"$ref":"#/components/parameters/created_date"}],"responses":{"200":{"description":"A list of price lists.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}}}}}}}}}}
```

## Create a price list

> Create a new price list with the specified data.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"403":{"description":"Forbidden"}}},"paths":{"/api/v1/price_list/":{"post":{"summary":"Create a price list","description":"Create a new price list with the specified data.","tags":["Price Lists"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"responses":{"201":{"description":"Price list created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"400":{"$ref":"#/components/responses/400"},"403":{"$ref":"#/components/responses/403"}}}}}}
```


# Product Prices

## Retrieve a product price

> Retrieve the fields of a specific product price by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/product_price/{id}":{"get":{"summary":"Retrieve a product price","description":"Retrieve the fields of a specific product price by ID.","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Product price retrieved successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Retrieve a product price with details

> Retrieve the details of a specific product price by ID with additional details.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ProductPriceDetailed":{"allOf":[{"$ref":"#/components/schemas/ProductPrice"}],"properties":{"product":{"$ref":"#/components/schemas/Product"},"price_list":{"$ref":"#/components/schemas/PriceList"}}},"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"Product":{"type":"object","properties":{"id":{"type":"integer","format":"int64","readOnly":true,"description":"Unique identifier for the product"},"name":{"type":"string","description":"Name of the product","maxLength":255},"base_code":{"type":"string","description":"Base code for product variants","nullable":true},"sku":{"type":"string","description":"Stock keeping unit - unique identifier for the product","maxLength":255},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product price."},"description":{"type":"string","description":"Detailed description of the product","maxLength":512,"nullable":true},"brand":{"type":"integer","description":"Foreign key to Brand model","nullable":true},"erp_categories":{"type":"array","items":{"type":"integer"},"description":"List of ERP category IDs"},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate percentage","maximum":999.99,"minimum":0,"nullable":true},"weight":{"type":"number","format":"decimal","description":"Product weight","maximum":99999999.99,"minimum":0,"nullable":true},"product_type":{"type":"string","enum":["pre_product","simple","product_meta","bundle","grouped","pre_miscellaneous","miscellaneous","offer"],"description":"Type of the product"},"productization_date":{"type":"string","format":"date-time","nullable":true,"description":"Date when product was productized from pre status"},"data_source":{"type":"integer","description":"Foreign key to DataSource model","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the product was created"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the product was last updated"},"is_active":{"type":"boolean","description":"Whether the product is currently active","default":true},"attribute_set":{"type":"integer","description":"Foreign key to AttributeSet model","nullable":true},"parent":{"type":"integer","description":"Foreign key to parent Product","nullable":true},"group_products":{"type":"array","items":{"type":"integer"},"description":"List of product IDs in the group","nullable":true},"attributes":{"type":"object","description":"Dynamic attributes stored as JSON","additionalProperties":true,"nullable":true},"listing_code":{"type":"string","description":"Listing code for the product","nullable":true},"is_seller_product":{"type":"boolean","description":"Whether the product is a seller product","default":false},"custom_attribute_set":{"type":"integer","description":"Foreign key to AttributeSet model","nullable":true}},"required":["name","sku","barcode","product_type"]},"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/product_price/{id}/detailed/":{"get":{"summary":"Retrieve a product price with details","description":"Retrieve the details of a specific product price by ID with additional details.","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Product price with details retrieved successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPriceDetailed"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Update a product price

> Update the fields of a specific product price by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}}}},"paths":{"/api/v1/product_price/{id}/":{"put":{"summary":"Update a product price","description":"Update the fields of a specific product price by ID.","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"responses":{"200":{"description":"Product price updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"406":{"$ref":"#/components/responses/406"}}}}}}
```

## Delete a product price

> Delete a specific product price by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"204":{"description":"No content"},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}}}},"paths":{"/api/v1/product_price/{id}/":{"delete":{"summary":"Delete a product price","description":"Delete a specific product price by ID.","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"}}}}}}
```

## Partial update a product price

> Update specific fields of a specific product price by ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}}}},"paths":{"/api/v1/product_price/{id}/":{"patch":{"summary":"Partial update a product price","description":"Update specific fields of a specific product price by ID.","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"responses":{"200":{"description":"Product price updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"406":{"$ref":"#/components/responses/406"}}}}}}
```

## Bulk Upsert Product Prices

> Create or update multiple product prices in bulk

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}}}},"paths":{"/api/v1/product_price/bulk_upsert/":{"post":{"summary":"Bulk Upsert Product Prices","description":"Create or update multiple product prices in bulk","tags":["ProductPrices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductPrice"}}}}},"responses":{"200":{"description":"Successfully processed bulk upsert","content":{"application/json":{"schema":{"type":"object","description":"Empty response on success"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"}}}}}}
```

## List Product Prices

> Retrieve a list of product prices with optional filters

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"product":{"name":"product","in":"query","required":false,"description":"Filter by Product ID.","schema":{"type":"integer","format":"int64"}},"is_active":{"name":"is_active","in":"query","description":"Filter by active status (True or False)","required":false,"schema":{"type":"boolean"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false},"price_list":{"name":"price_list","in":"query","required":false,"description":"Filter by Price List ID.","schema":{"type":"integer","format":"int64"}},"currency_type":{"name":"currency_type","in":"query","required":false,"description":"Filter by Currency Type.","schema":{"$ref":"#/components/schemas/CurrencyEnum"}},"price":{"name":"price","in":"query","required":false,"description":"Filter by the product price.","schema":{"type":"number","format":"decimal"}},"tax_rate":{"name":"tax_rate","in":"query","required":false,"description":"Filter by Tax Rate.","schema":{"type":"number","format":"decimal"}},"retail_price":{"name":"retail_price","in":"query","required":false,"description":"Filter by Retail Price.","schema":{"type":"number","format":"decimal"}},"product__attributes__some_key":{"name":"product__attributes__some_key","in":"query","description":"Filter by a specific key in the 'attributes' JSON object of the product.","required":false,"schema":{"type":"string"}},"product__localized_attributes__some_key":{"name":"product__localized_attributes__some_key","in":"query","description":"Filter by a specific key in the 'localized_attributes' JSON object of the product.","required":false,"schema":{"type":"string"}},"extra_field__some_key":{"name":"extra_field__some_key","in":"query","description":"Filter by a specific key in the 'extra_field' JSON object.","required":false,"schema":{"type":"string"}}},"schemas":{"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}}}},"paths":{"/api/v1/product_price/":{"get":{"summary":"List Product Prices","description":"Retrieve a list of product prices with optional filters","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/product"},{"$ref":"#/components/parameters/is_active"},{"$ref":"#/components/parameters/modified_date"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/pk__in"},{"$ref":"#/components/parameters/price_list"},{"$ref":"#/components/parameters/currency_type"},{"$ref":"#/components/parameters/price"},{"$ref":"#/components/parameters/tax_rate"},{"$ref":"#/components/parameters/retail_price"},{"$ref":"#/components/parameters/product__attributes__some_key"},{"$ref":"#/components/parameters/product__localized_attributes__some_key"},{"$ref":"#/components/parameters/extra_field__some_key"}],"responses":{"200":{"description":"List of Product Prices","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","description":"Total number of items"},"next":{"type":"string","nullable":true,"description":"URL for next page"},"previous":{"type":"string","nullable":true,"description":"URL for previous page"},"results":{"type":"array","items":{"$ref":"#/components/schemas/ProductPrice"}}}}}}},"401":{"$ref":"#/components/responses/401"}}}}}}
```

## Create a product price

> Create a new product price with the specified data.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"403":{"description":"Forbidden"},"406":{"description":"A custom 406 error occurs due to different validation failures in viewset or service level, such as uniqueness checks or other service-related exceptions.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Detailed message of the 406 error."}}}}}}}},"paths":{"/api/v1/product_price/":{"post":{"summary":"Create a product price","description":"Create a new product price with the specified data.","tags":["ProductPrices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"responses":{"201":{"description":"Product price created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPrice"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"406":{"$ref":"#/components/responses/406"}}}}}}
```

## List Product Prices with Details

> Retrieve a detailed list of product prices with optional filters

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"product":{"name":"product","in":"query","required":false,"description":"Filter by Product ID.","schema":{"type":"integer","format":"int64"}},"is_active":{"name":"is_active","in":"query","description":"Filter by active status (True or False)","required":false,"schema":{"type":"boolean"}},"modified_date":{"name":"modified_date","in":"query","required":false,"description":"Filter by modification date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"created_date":{"name":"created_date","in":"query","required":false,"description":"Filter by creation date using supported lookup expressions (e.g., `gt`, `gte`, `lt`, `lte`, `date__gt`, etc.).","schema":{"type":"string","format":"date-time"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false},"price_list":{"name":"price_list","in":"query","required":false,"description":"Filter by Price List ID.","schema":{"type":"integer","format":"int64"}},"currency_type":{"name":"currency_type","in":"query","required":false,"description":"Filter by Currency Type.","schema":{"$ref":"#/components/schemas/CurrencyEnum"}},"price":{"name":"price","in":"query","required":false,"description":"Filter by the product price.","schema":{"type":"number","format":"decimal"}},"tax_rate":{"name":"tax_rate","in":"query","required":false,"description":"Filter by Tax Rate.","schema":{"type":"number","format":"decimal"}},"retail_price":{"name":"retail_price","in":"query","required":false,"description":"Filter by Retail Price.","schema":{"type":"number","format":"decimal"}},"product__attributes__some_key":{"name":"product__attributes__some_key","in":"query","description":"Filter by a specific key in the 'attributes' JSON object of the product.","required":false,"schema":{"type":"string"}},"product__localized_attributes__some_key":{"name":"product__localized_attributes__some_key","in":"query","description":"Filter by a specific key in the 'localized_attributes' JSON object of the product.","required":false,"schema":{"type":"string"}},"extra_field__some_key":{"name":"extra_field__some_key","in":"query","description":"Filter by a specific key in the 'extra_field' JSON object.","required":false,"schema":{"type":"string"}},"product__sku__exact":{"name":"product__sku__exact","in":"query","description":"Filter by exact SKU.","schema":{"type":"string"}},"product__sku__in":{"name":"product__sku__in","in":"query","description":"Filter by multiple SKUs (comma-separated).","schema":{"type":"array","items":{"type":"string"}}},"product__sku_exclude__exact":{"name":"product__sku_exclude__exact","in":"query","description":"Exclude exact SKU.","schema":{"type":"string"}},"product__sku_exclude__in":{"name":"product__sku_exclude__in","in":"query","description":"Exclude multiple SKUs (comma-separated).","schema":{"type":"array","items":{"type":"string"}}},"product__base_code_exclude__in":{"name":"product__base_code_exclude__in","in":"query","description":"Exclude multiple base codes (comma-separated).","schema":{"type":"array","items":{"type":"string"}}},"product__base_code__exact":{"name":"product__base_code__exact","in":"query","description":"Filter by exact base code.","schema":{"type":"string"}},"product__base_code__iexact":{"name":"product__base_code__iexact","in":"query","description":"Filter by base code (case-insensitive).","schema":{"type":"string"}},"product__base_code_exclude__exact":{"name":"product__base_code_exclude__exact","in":"query","description":"Exclude exact base code.","schema":{"type":"string"}},"product__base_code_exclude__iexact":{"name":"product__base_code_exclude__iexact","in":"query","description":"Exclude base code (case-insensitive).","schema":{"type":"string"}},"product__pk__in":{"name":"product__pk__in","in":"query","description":"Filter by multiple primary keys (comma-separated).","schema":{"type":"array","items":{"type":"integer"}}},"product__attributes":{"name":"product__attributes","in":"query","description":"Filter by attributes in JSON format.","schema":{"type":"string"}},"product__attributes_exclude":{"name":"product__attributes_exclude","in":"query","description":"Exclude attributes in JSON format.","schema":{"type":"string"}},"product__attributes_kwargs":{"name":"product__attributes_kwargs","in":"query","description":"Filter by attributes using additional keyword arguments.","schema":{"type":"string"}},"product__localized_attributes":{"name":"product__localized_attributes","in":"query","description":"Filter by localized attributes in JSON format.","schema":{"type":"string"}},"product__localized_attributes_kwargs":{"name":"product__localized_attributes_kwargs","in":"query","description":"Filter by localized attributes with additional keywords.","schema":{"type":"string"}},"product__extra_attributes":{"name":"product__extra_attributes","in":"query","description":"Filter by extra attributes.","schema":{"type":"string"}},"product__product_type":{"name":"product__product_type","in":"query","description":"Filter by product type.","schema":{"type":"array","items":{"type":"string"},"enum":["-2","-1","0","1","2","3","4","5"]}},"product__product_type_exclude":{"name":"product__product_type_exclude","in":"query","description":"Exclude product types.","schema":{"type":"array","items":{"type":"string"},"enum":["-2","-1","0","1","2","3","4","5"]}},"product__attribute_set":{"name":"product__attribute_set","in":"query","description":"Filter by attribute sets.","schema":{"type":"array","items":{"type":"integer"}}},"product__attribute_set_exclude":{"name":"product__attribute_set_exclude","in":"query","description":"Exclude specific attribute sets.","schema":{"type":"array","items":{"type":"integer"}}},"product__parent":{"name":"product__parent","in":"query","description":"Filter by parent product ID.","schema":{"type":"integer"}},"product__offer_parent":{"name":"product__offer_parent","in":"query","description":"Filter by parent products with a 'simple' product type.","schema":{"type":"integer"}},"product__group_parent_set":{"name":"product__group_parent_set","in":"query","description":"Filter by parent products with a 'grouped' product type.","schema":{"type":"array","items":{"type":"integer"}}},"product__group_products":{"name":"product__group_products","in":"query","description":"Filter by grouped products.","schema":{"type":"array","items":{"type":"integer"}}},"product__parent__isnull":{"name":"product__parent__isnull","in":"query","description":"Filter by whether parent is null (True or False).","schema":{"type":"boolean"}},"product__catalogitem":{"name":"product__catalogitem","in":"query","description":"Filter by catalog items.","schema":{"type":"array","items":{"type":"integer"}}},"product__listable_products_only":{"name":"product__listable_products_only","in":"query","description":"Filter by listable products only (True or False).","schema":{"type":"boolean"}},"product__productimage__isnull":{"name":"product__productimage__isnull","in":"query","description":"Filter by whether the product has associated images.","schema":{"type":"boolean"}},"product__productvideo__isnull":{"name":"product__productvideo__isnull","in":"query","description":"Filter by whether the product has associated videos.","schema":{"type":"boolean"}},"product__downloadableimage__isnull":{"name":"product__downloadableimage__isnull","in":"query","description":"Filter by whether the product has downloadable images.","schema":{"type":"boolean"}},"product__stock_list_not_contains":{"name":"product__stock_list_not_contains","in":"query","description":"Exclude products in specific stock lists.","schema":{"type":"string"}},"product__price_list_not_contains":{"name":"product__price_list_not_contains","in":"query","description":"Exclude products in specific price lists.","schema":{"type":"string"}},"product__productization_date":{"name":"product__productization_date","in":"query","description":"Filter by productization date with lookup expressions (e.g., `gte`, `lte`).","schema":{"type":"string"}},"product__attribute_set__isnull":{"name":"product__attribute_set__isnull","in":"query","description":"Filter by whether attribute set is null.","schema":{"type":"boolean"}},"product__exclude_bundle_chapter_products":{"name":"product__exclude_bundle_chapter_products","in":"query","description":"Exclude products associated with specific bundle chapters.","schema":{"type":"integer"}},"product__discounted":{"name":"product__discounted","in":"query","description":"Filter by discounted products.","schema":{"type":"boolean"}},"product__data_source":{"name":"product__data_source","in":"query","description":"Filter by data source IDs.","schema":{"type":"array","items":{"type":"integer"}}},"product__data_source_exclude":{"name":"product__data_source_exclude","in":"query","description":"Exclude specific data sources.","schema":{"type":"array","items":{"type":"integer"}}},"product__data_source__isnull":{"name":"product__data_source__isnull","in":"query","description":"Filter by whether data source is null.","schema":{"type":"boolean"}},"product__exclude_passive_distributed_products":{"name":"product__exclude_passive_distributed_products","in":"query","description":"Exclude passive distributed products.","schema":{"type":"boolean"}},"product__custom_attribute_set":{"name":"product__custom_attribute_set","in":"query","description":"Filter by custom attribute set IDs.","schema":{"type":"array","items":{"type":"integer"}}},"product__brand":{"name":"product__brand","in":"query","description":"Filter by brand ID.","schema":{"type":"integer"}},"product__erp_categories":{"name":"product__erp_categories","in":"query","description":"Filter by ERP category ID.","schema":{"type":"integer"}},"integration__channel":{"name":"channel","in":"query","description":"Filter by channel ID.","schema":{"type":"integer"}},"integration__channel_id":{"name":"channel_id","in":"query","description":"Filter by exact channel ID.","schema":{"type":"integer"}},"integration__channel_name":{"name":"channel_name","in":"query","description":"Filter by channel name (case-insensitive).","schema":{"type":"string"}},"integration__content_type_name":{"name":"content_type_name","in":"query","description":"Filter by content type model name.","schema":{"type":"string"}},"integration__status":{"name":"status","in":"query","description":"Filter by multiple status values.","schema":{"type":"array","items":{"type":"string","enum":["processing","success","error"]}}},"integration__version_date":{"name":"version_date","in":"query","description":"Filter by version date using various lookup expressions.","schema":{"type":"string","format":"date-time"}},"integration__remote_id__in":{"name":"remote_id__in","in":"query","description":"Filter by multiple remote IDs.","schema":{"type":"array","items":{"type":"string"}}},"integration__remote_id__exact":{"name":"remote_id__exact","in":"query","description":"Filter by exact remote ID.","schema":{"type":"string"}},"integration__object_id__in":{"name":"object_id__in","in":"query","description":"Filter by multiple object IDs.","schema":{"type":"array","items":{"type":"integer"}}},"integration__state":{"name":"state","in":"query","description":"Filter by state using JSON-based filtering.","schema":{"type":"string","format":"json"}},"integration__local_batch_id__exact":{"name":"local_batch_id__exact","in":"query","description":"Filter by exact local batch ID.","schema":{"type":"string"}}},"schemas":{"CurrencyEnum":{"type":"string","description":"Currency type for the price list.","enum":["tr","eu","usd","egp","gbp","mad","pln","sar","ron","uah","czk","huf","rub","bgn","iqd","kwd","bhd","omr","qar","aed","ngn","inr","lei","kzt","jod","rsd"]},"ProductPriceDetailed":{"allOf":[{"$ref":"#/components/schemas/ProductPrice"}],"properties":{"product":{"$ref":"#/components/schemas/Product"},"price_list":{"$ref":"#/components/schemas/PriceList"}}},"ProductPrice":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Product Price ID"},"product":{"type":"integer","nullable":false,"description":"ID of the product related with the price."},"price_list":{"type":"integer","nullable":false,"description":"ID of the price list related with the price."},"retail_price":{"type":"number","format":"decimal","nullable":true,"description":"Retail price of the product, can be null or blank."},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate applied to the product price."},"currency_type":{"$ref":"#/components/schemas/CurrencyEnum"},"price":{"type":"number","format":"decimal","description":"The actual price of the product."},"price_type":{"type":"string","description":"Type of the price.","enum":["default","range_"]},"discount_percentage":{"type":"number","format":"decimal","description":"Discount percentage applied to the price, if any."},"extra_field":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Extra fields related to the product price in JSON format."},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Product Price"},"modified_date":{"type":"string","format":"date-time","description":"Modification Date of the Product Price"}}},"Product":{"type":"object","properties":{"id":{"type":"integer","format":"int64","readOnly":true,"description":"Unique identifier for the product"},"name":{"type":"string","description":"Name of the product","maxLength":255},"base_code":{"type":"string","description":"Base code for product variants","nullable":true},"sku":{"type":"string","description":"Stock keeping unit - unique identifier for the product","maxLength":255},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the product price."},"description":{"type":"string","description":"Detailed description of the product","maxLength":512,"nullable":true},"brand":{"type":"integer","description":"Foreign key to Brand model","nullable":true},"erp_categories":{"type":"array","items":{"type":"integer"},"description":"List of ERP category IDs"},"tax_rate":{"type":"number","format":"decimal","description":"Tax rate percentage","maximum":999.99,"minimum":0,"nullable":true},"weight":{"type":"number","format":"decimal","description":"Product weight","maximum":99999999.99,"minimum":0,"nullable":true},"product_type":{"type":"string","enum":["pre_product","simple","product_meta","bundle","grouped","pre_miscellaneous","miscellaneous","offer"],"description":"Type of the product"},"productization_date":{"type":"string","format":"date-time","nullable":true,"description":"Date when product was productized from pre status"},"data_source":{"type":"integer","description":"Foreign key to DataSource model","nullable":true},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the product was created"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Timestamp when the product was last updated"},"is_active":{"type":"boolean","description":"Whether the product is currently active","default":true},"attribute_set":{"type":"integer","description":"Foreign key to AttributeSet model","nullable":true},"parent":{"type":"integer","description":"Foreign key to parent Product","nullable":true},"group_products":{"type":"array","items":{"type":"integer"},"description":"List of product IDs in the group","nullable":true},"attributes":{"type":"object","description":"Dynamic attributes stored as JSON","additionalProperties":true,"nullable":true},"listing_code":{"type":"string","description":"Listing code for the product","nullable":true},"is_seller_product":{"type":"boolean","description":"Whether the product is a seller product","default":false},"custom_attribute_set":{"type":"integer","description":"Foreign key to AttributeSet model","nullable":true}},"required":["name","sku","barcode","product_type"]},"PriceList":{"type":"object","properties":{"pk":{"type":"integer","format":"int64","description":"Price List ID"},"name":{"type":"string","maxLength":64,"description":"Name of the price list."},"code":{"type":"string","nullable":true,"maxLength":64,"description":"Unique code for the price list. Can be null or blank."},"currency":{"$ref":"#/components/schemas/CurrencyEnum"},"is_auto_sync":{"type":"boolean","description":"Indicates whether the price list is auto-synchronized with an external integration.","default":false},"created_date":{"type":"string","format":"date-time","description":"Creation Date of the Price List"},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date of the Price List"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}}}},"paths":{"/api/v1/product_price/detailed/":{"get":{"summary":"List Product Prices with Details","description":"Retrieve a detailed list of product prices with optional filters","tags":["ProductPrices"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/product"},{"$ref":"#/components/parameters/is_active"},{"$ref":"#/components/parameters/modified_date"},{"$ref":"#/components/parameters/created_date"},{"$ref":"#/components/parameters/pk__in"},{"$ref":"#/components/parameters/price_list"},{"$ref":"#/components/parameters/currency_type"},{"$ref":"#/components/parameters/price"},{"$ref":"#/components/parameters/tax_rate"},{"$ref":"#/components/parameters/retail_price"},{"$ref":"#/components/parameters/product__attributes__some_key"},{"$ref":"#/components/parameters/product__localized_attributes__some_key"},{"$ref":"#/components/parameters/extra_field__some_key"},{"$ref":"#/components/parameters/product__sku__exact"},{"$ref":"#/components/parameters/product__sku__in"},{"$ref":"#/components/parameters/product__sku_exclude__exact"},{"$ref":"#/components/parameters/product__sku_exclude__in"},{"$ref":"#/components/parameters/product__base_code_exclude__in"},{"$ref":"#/components/parameters/product__base_code__exact"},{"$ref":"#/components/parameters/product__base_code__iexact"},{"$ref":"#/components/parameters/product__base_code_exclude__exact"},{"$ref":"#/components/parameters/product__base_code_exclude__iexact"},{"$ref":"#/components/parameters/product__pk__in"},{"$ref":"#/components/parameters/product__attributes"},{"$ref":"#/components/parameters/product__attributes_exclude"},{"$ref":"#/components/parameters/product__attributes_kwargs"},{"$ref":"#/components/parameters/product__localized_attributes"},{"$ref":"#/components/parameters/product__localized_attributes_kwargs"},{"$ref":"#/components/parameters/product__extra_attributes"},{"$ref":"#/components/parameters/product__product_type"},{"$ref":"#/components/parameters/product__product_type_exclude"},{"$ref":"#/components/parameters/product__attribute_set"},{"$ref":"#/components/parameters/product__attribute_set_exclude"},{"$ref":"#/components/parameters/product__parent"},{"$ref":"#/components/parameters/product__offer_parent"},{"$ref":"#/components/parameters/product__group_parent_set"},{"$ref":"#/components/parameters/product__group_products"},{"$ref":"#/components/parameters/product__parent__isnull"},{"$ref":"#/components/parameters/product__catalogitem"},{"$ref":"#/components/parameters/product__listable_products_only"},{"$ref":"#/components/parameters/product__productimage__isnull"},{"$ref":"#/components/parameters/product__productvideo__isnull"},{"$ref":"#/components/parameters/product__downloadableimage__isnull"},{"$ref":"#/components/parameters/product__stock_list_not_contains"},{"$ref":"#/components/parameters/product__price_list_not_contains"},{"$ref":"#/components/parameters/product__productization_date"},{"$ref":"#/components/parameters/product__attribute_set__isnull"},{"$ref":"#/components/parameters/product__exclude_bundle_chapter_products"},{"$ref":"#/components/parameters/product__discounted"},{"$ref":"#/components/parameters/product__data_source"},{"$ref":"#/components/parameters/product__data_source_exclude"},{"$ref":"#/components/parameters/product__data_source__isnull"},{"$ref":"#/components/parameters/product__exclude_passive_distributed_products"},{"$ref":"#/components/parameters/product__custom_attribute_set"},{"$ref":"#/components/parameters/product__brand"},{"$ref":"#/components/parameters/product__erp_categories"},{"$ref":"#/components/parameters/integration__channel"},{"$ref":"#/components/parameters/integration__channel_id"},{"$ref":"#/components/parameters/integration__channel_name"},{"$ref":"#/components/parameters/integration__content_type_name"},{"$ref":"#/components/parameters/integration__status"},{"$ref":"#/components/parameters/integration__version_date"},{"$ref":"#/components/parameters/integration__remote_id__in"},{"$ref":"#/components/parameters/integration__remote_id__exact"},{"$ref":"#/components/parameters/integration__object_id__in"},{"$ref":"#/components/parameters/integration__state"},{"$ref":"#/components/parameters/integration__local_batch_id__exact"}],"responses":{"200":{"description":"List of Product Prices with Details","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","description":"Total number of items"},"next":{"type":"string","nullable":true,"description":"URL for next page"},"previous":{"type":"string","nullable":true,"description":"URL for previous page"},"results":{"type":"array","items":{"$ref":"#/components/schemas/ProductPriceDetailed"}}}}}}},"401":{"$ref":"#/components/responses/401"}}}}}}
```


# Districts

## Retrieve District

> Retrieve a specific District by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/{id}/":{"get":{"summary":"Retrieve District","description":"Retrieve a specific District by ID","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"District retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/District"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update District

> Update a specific District by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/{id}/":{"put":{"summary":"Update District","description":"Update a specific District by ID","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/District"}}}},"responses":{"200":{"description":"District updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete District

> Delete a specific District by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/{id}/":{"delete":{"summary":"Delete District","description":"Delete a specific District by ID","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"District deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update District

> Partial update a specific District by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/{id}/":{"patch":{"summary":"Partial Update District","description":"Partial update a specific District by ID","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/District"}}}},"responses":{"200":{"description":"District updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve District with details

> Retrieve a specific District by ID with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"DistrictDetailed":{"allOf":[{"$ref":"#/components/schemas/District"}],"properties":{"city":{"$ref":"#/components/schemas/City"},"township":{"$ref":"#/components/schemas/Township"}}},"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]},"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/{id}/detailed/":{"get":{"summary":"Retrieve District with details","description":"Retrieve a specific District by ID with details","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"District retrieved successfully with details","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/DistrictDetailed"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Districts

> List Districts

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"city":{"name":"city_id","in":"query","required":false,"description":"Filter by City ID","schema":{"type":"integer","minimum":1}},"township":{"name":"township_id","in":"query","required":false,"description":"Filter by Township ID","schema":{"type":"integer","minimum":1}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}}},"schemas":{"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/":{"get":{"summary":"List Districts","description":"List Districts","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/township"},{"$ref":"#/components/parameters/postcode"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/District"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create District

> Create District

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/":{"post":{"summary":"Create District","description":"Create District","tags":["Districts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/District"}}}},"responses":{"201":{"description":"District Created","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/District"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Districts with details

> List Districts with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"city":{"name":"city_id","in":"query","required":false,"description":"Filter by City ID","schema":{"type":"integer","minimum":1}},"township":{"name":"township_id","in":"query","required":false,"description":"Filter by Township ID","schema":{"type":"integer","minimum":1}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}}},"schemas":{"DistrictDetailed":{"allOf":[{"$ref":"#/components/schemas/District"}],"properties":{"city":{"$ref":"#/components/schemas/City"},"township":{"$ref":"#/components/schemas/Township"}}},"District":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true,"description":"Primary key of the district"},"name":{"type":"string","format":"string","description":"District Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"township":{"type":"integer","format":"int64","description":"Related Township ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"},"zipcode":{"type":"string","format":"string","description":"Zipcode"}},"required":["city","township","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]},"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/districts/detailed/":{"get":{"summary":"List Districts with details","description":"List Districts with details","tags":["Districts"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/township"},{"$ref":"#/components/parameters/postcode"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/DistrictDetailed"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Cities

## Retrieve City

> Retrieve a specific City by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/{id}/":{"get":{"summary":"Retrieve City","description":"Retrieve a specific City by ID","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"City retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/City"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update City

> Update a specific City by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/{id}/":{"put":{"summary":"Update City","description":"Update a specific City by ID","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/City"}}}},"responses":{"200":{"description":"City updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete City

> Delete a specific City by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/{id}/":{"delete":{"summary":"Delete City","description":"Delete a specific City by ID","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"City deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update City

> Partial update a specific City by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/{id}/":{"patch":{"summary":"Partial Update City","description":"Partial update a specific City by ID","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/City"}}}},"responses":{"200":{"description":"City updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve City with details

> Retrieve a specific City by ID with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"CityDetailed":{"allOf":[{"$ref":"#/components/schemas/City"}],"properties":{"country":{"$ref":"#/components/schemas/Country"}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]},"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/{id}/detailed/":{"get":{"summary":"Retrieve City with details","description":"Retrieve a specific City by ID with details","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"City retrieved successfully with details","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/CityDetailed"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Cities

> List Cities

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"priority":{"name":"priority","in":"query","description":"Filter by priority","required":false,"schema":{"type":"integer"}},"country":{"name":"country_id","in":"query","required":false,"description":"Filter by County ID","schema":{"type":"integer","minimum":1}},"country__name":{"name":"country__name__exact","in":"query","required":false,"description":"Filter by Country Name","schema":{"type":"string"}},"country__code":{"name":"country__code__exact","in":"query","required":false,"description":"Filter by Country Code","schema":{"type":"string"}},"country__mapping__code__exact":{"name":"country__mapping__code__exact","in":"query","description":"Filter by country's integration mapping object's code","required":false,"schema":{"type":"string"}},"country__mapping__integration_type":{"name":"country__mapping__integration_type","in":"query","description":"Filter by country's integration mapping object's integration type","required":false,"schema":{"allOf":[{"$ref":"#/components/parameters/mapping__integration_type/schema"}]}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}}},"schemas":{"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/":{"get":{"summary":"List Cities","description":"List Cities","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/priority"},{"$ref":"#/components/parameters/country"},{"$ref":"#/components/parameters/country__name"},{"$ref":"#/components/parameters/country__code"},{"$ref":"#/components/parameters/country__mapping__code__exact"},{"$ref":"#/components/parameters/country__mapping__integration_type"},{"$ref":"#/components/parameters/postcode"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/City"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create City

> Create City

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/":{"post":{"summary":"Create City","description":"Create City","tags":["Cities"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/City"}}}},"responses":{"201":{"description":"City Created","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/City"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Cities with details

> List Cities with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"priority":{"name":"priority","in":"query","description":"Filter by priority","required":false,"schema":{"type":"integer"}},"country":{"name":"country_id","in":"query","required":false,"description":"Filter by County ID","schema":{"type":"integer","minimum":1}},"country__name":{"name":"country__name__exact","in":"query","required":false,"description":"Filter by Country Name","schema":{"type":"string"}},"country__code":{"name":"country__code__exact","in":"query","required":false,"description":"Filter by Country Code","schema":{"type":"string"}},"country__mapping__code__exact":{"name":"country__mapping__code__exact","in":"query","description":"Filter by country's integration mapping object's code","required":false,"schema":{"type":"string"}},"country__mapping__integration_type":{"name":"country__mapping__integration_type","in":"query","description":"Filter by country's integration mapping object's integration type","required":false,"schema":{"allOf":[{"$ref":"#/components/parameters/mapping__integration_type/schema"}]}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}}},"schemas":{"CityDetailed":{"allOf":[{"$ref":"#/components/schemas/City"}],"properties":{"country":{"$ref":"#/components/schemas/Country"}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]},"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/cities/detailed/":{"get":{"summary":"List Cities with details","description":"List Cities with details","tags":["Cities"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/priority"},{"$ref":"#/components/parameters/country"},{"$ref":"#/components/parameters/country__name"},{"$ref":"#/components/parameters/country__code"},{"$ref":"#/components/parameters/country__mapping__code__exact"},{"$ref":"#/components/parameters/country__mapping__integration_type"},{"$ref":"#/components/parameters/postcode"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/CityDetailed"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create mapping for City

> Create mapping for City

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"IntegrationMapping":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true},"content_type":{"type":"integer","description":"Associated content type id"},"object_id":{"type":"integer","description":"Associated content type's object id value"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"},"integration_type":{"type":"string","maxLength":20,"enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]},"code":{"type":"string","maxLength":499,"description":"Code value of integration mapping"}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/create_mapping/":{"get":{"summary":"Create mapping for City","description":"Create mapping for City","tags":["Cities","SalesChannelAddresses","SalesChannelCities","SalesChannelCancellationPlans","Districts","SalesChannelDistricts","SalesChannelCountries","Countries","Townships","SalesChannelTownships"],"responses":{"200":{"description":"Mapping created successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/IntegrationMapping"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Get mappings for City

> Get mappings for City

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"IntegrationMapping":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","readOnly":true},"content_type":{"type":"integer","description":"Associated content type id"},"object_id":{"type":"integer","description":"Associated content type's object id value"},"content_object":{"type":"object","nullable":true,"description":"Generic foreign key, handled dynamically"},"integration_type":{"type":"string","maxLength":20,"enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]},"code":{"type":"string","maxLength":499,"description":"Code value of integration mapping"}}},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/get_mappings/":{"get":{"summary":"Get mappings for City","description":"Get mappings for City","tags":["Cities","SalesChannelAddresses","SalesChannelCities","SalesChannelCancellationPlans","Districts","SalesChannelDistricts","SalesChannelCountries","Countries","Townships","SalesChannelTownships"],"responses":{"200":{"description":"Mapping collected successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/IntegrationMapping"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Get integration mapping types for City

> Get integration mapping types for City

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/get_integration_mapping_types/":{"get":{"summary":"Get integration mapping types for City","description":"Get integration mapping types for City","tags":["Cities","SalesChannelAddresses","SalesChannelCities","SalesChannelCancellationPlans","Districts","SalesChannelDistricts","SalesChannelCountries","Countries","Townships","SalesChannelTownships"],"responses":{"200":{"description":"Integration Mapping Types collected successfully","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Countries

## Retrieve Country

> Retrieve a specific Country by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/{id}/":{"get":{"summary":"Retrieve Country","description":"Retrieve a specific Country by ID","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Country retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/Country"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Country

> Update a specific Country by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/{id}/":{"put":{"summary":"Update Country","description":"Update a specific Country by ID","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Country"}}}},"responses":{"200":{"description":"Country updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Country

> Delete a specific Country by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/{id}/":{"delete":{"summary":"Delete Country","description":"Delete a specific Country by ID","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Country deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update Country

> Partial update a specific Country by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/{id}/":{"patch":{"summary":"Partial Update Country","description":"Partial update a specific Country by ID","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Country"}}}},"responses":{"200":{"description":"Country updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve Country with details

> Retrieve a specific Country by ID with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/{id}/detailed/":{"get":{"summary":"Retrieve Country with details","description":"Retrieve a specific Country by ID with details","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Country retrieved successfully with details","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/Country"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Countries

> List Countries

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"code__exact":{"name":"code__exact","in":"query","required":false,"description":"Filters by exact code","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/":{"get":{"summary":"List Countries","description":"List Countries","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/code__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/Country"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create Country

> Create Country

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/":{"post":{"summary":"Create Country","description":"Create Country","tags":["Countries"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Country"}}}},"responses":{"201":{"description":"Country Created","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/Country"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Countries with details

> List Countries with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"code__exact":{"name":"code__exact","in":"query","required":false,"description":"Filters by exact code","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}}},"schemas":{"Country":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Country ID"},"name":{"type":"string","description":"Country Name"},"code":{"type":"string","description":"Country Code"},"is_active":{"type":"boolean","description":"Is Active (true/false)"},"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"Created Date"},"modified_date":{"type":"string","format":"date-time","readOnly":true,"description":"Modified Date"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true}},"required":["name","code"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/countries/detailed/":{"get":{"summary":"List Countries with details","description":"List Countries with details","tags":["Countries"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/code__exact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/Country"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Townships

## Retrieve Township

> Retrieve a specific Township by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/{id}/":{"get":{"summary":"Retrieve Township","description":"Retrieve a specific Township by ID","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Township retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/Township"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Township

> Update a specific Township by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/{id}/":{"put":{"summary":"Update Township","description":"Update a specific Township by ID","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Township"}}}},"responses":{"200":{"description":"Township updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Township

> Delete a specific Township by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/{id}/":{"delete":{"summary":"Delete Township","description":"Delete a specific Township by ID","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Township deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update Township

> Partial update a specific Township by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/{id}/":{"patch":{"summary":"Partial Update Township","description":"Partial update a specific Township by ID","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Township"}}}},"responses":{"200":{"description":"Township updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve Township with details

> Retrieve a specific Township by ID with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"TownshipDetailed":{"allOf":[{"$ref":"#/components/schemas/Township"}],"properties":{"city":{"$ref":"#/components/schemas/City"}}},"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/{id}/detailed/":{"get":{"summary":"Retrieve Township with details","description":"Retrieve a specific Township by ID with details","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Township retrieved successfully with details","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/TownshipDetailed"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Townships

> List Townships

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"name__iexact":{"name":"name__iexact","in":"query","required":false,"description":"Filters case insensitive by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"priority":{"name":"priority","in":"query","description":"Filter by priority","required":false,"schema":{"type":"integer"}},"city":{"name":"city_id","in":"query","required":false,"description":"Filter by City ID","schema":{"type":"integer","minimum":1}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false}},"schemas":{"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/":{"get":{"summary":"List Townships","description":"List Townships","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/name__iexact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/priority"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/postcode"},{"$ref":"#/components/parameters/pk__in"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/Township"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create Township

> Create Township

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/":{"post":{"summary":"Create Township","description":"Create Township","tags":["Townships"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Township"}}}},"responses":{"201":{"description":"Township Created","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/Township"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Townships with details

> List Townships with details

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"name__exact":{"name":"name__exact","in":"query","required":false,"description":"Filters by exact name","schema":{"type":"string"}},"name__iexact":{"name":"name__iexact","in":"query","required":false,"description":"Filters case insensitive by exact name","schema":{"type":"string"}},"mapping__integration_type":{"name":"mapping__integration_type","in":"query","description":"Filter by integration mapping object's integration type","required":false,"schema":{"type":"string","enum":["hepsiburada","hepsiburadaads","n11","web","external_company","gittigidiyor","trendyol","ups","morhipo","morhipoV2","amazon","b2c_direct","allegro","akinon","ay_cargo","aliexpress","emag","yurtici","ciceksepeti","fancourier","diva","hana","gordumaldim","pazarama","flo","dpd","cdek","turkcellds","sales_channel","kolay_gelsin","sameday","sendeo","cargus","dataeva","speedy","modanisa"]}},"mapping__code__exact":{"name":"mapping__code__exact","in":"query","description":"Filter by integration mapping object's code","required":false,"schema":{"type":"string"}},"hyper":{"name":"hyper","in":"query","description":"Activate id to hyperlink the response data.","required":false,"schema":{"type":"boolean"}},"priority":{"name":"priority","in":"query","description":"Filter by priority","required":false,"schema":{"type":"integer"}},"city":{"name":"city_id","in":"query","required":false,"description":"Filter by City ID","schema":{"type":"integer","minimum":1}},"postcode":{"name":"postcode","in":"query","required":false,"description":"Filter by Postcode","schema":{"type":"string"}},"pk__in":{"name":"pk__in","in":"query","description":"Filter by multiple primary key values (comma-separated list of integers)","required":false,"schema":{"type":"array","items":{"type":"integer"}},"style":"form","explode":false}},"schemas":{"TownshipDetailed":{"allOf":[{"$ref":"#/components/schemas/Township"}],"properties":{"city":{"$ref":"#/components/schemas/City"}}},"Township":{"type":"object","allOf":[{"$ref":"#/components/schemas/StarterModel"}],"properties":{"pk":{"type":"integer","description":"Primary key of the township"},"name":{"type":"string","format":"string","description":"Township Name"},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"city":{"type":"integer","format":"int64","description":"Related City ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["city","name"]},"StarterModel":{"type":"object","properties":{"created_date":{"type":"string","format":"date-time","readOnly":true,"description":"The date and time when the object was created."},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the object was last modified."}}},"City":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"City ID"},"name":{"type":"string","format":"string","description":"City Name"},"created_date":{"type":"string","format":"date-time","description":"Creation Date","readOnly":true},"modified_date":{"type":"string","format":"date-time","description":"Last Modification Date","readOnly":true},"is_active":{"type":"boolean","description":"Is it active? (True/False)"},"country":{"type":"integer","format":"int64","description":"Related Country ID"},"translations":{"type":"object","description":"A dynamic object holding translations for different languages","additionalProperties":{"type":"string"},"readOnly":true},"priority":{"type":"integer","format":"int64","description":"Priority"},"postcode":{"type":"string","format":"string","description":"Postcode"}},"required":["country","name"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/townships/detailed/":{"get":{"summary":"List Townships with details","description":"List Townships with details","tags":["Townships"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/name__exact"},{"$ref":"#/components/parameters/name__iexact"},{"$ref":"#/components/parameters/mapping__integration_type"},{"$ref":"#/components/parameters/mapping__code__exact"},{"$ref":"#/components/parameters/hyper"},{"$ref":"#/components/parameters/priority"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/postcode"},{"$ref":"#/components/parameters/pk__in"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","description":"Next page URL","nullable":true},"previous":{"type":"string","description":"Previous page URL","nullable":true},"results":{"type":"array","items":{"$ref":"#/components/schemas/TownshipDetailed"}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Prometheus Metrics

## Get task distribution by queue

> Returns grouped task count per domain and detailed task information

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/api/v1/prometheus_metrics/":{"get":{"summary":"Get task distribution by queue","description":"Returns grouped task count per domain and detailed task information","tags":["PrometheusMetrics"],"parameters":[{"name":"queue_name","in":"query","required":false,"schema":{"type":"string","description":"The name of the queue to get metrics for"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","properties":{"total":{"type":"integer"},"tasks":{"type":"object","additionalProperties":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}}}}}}}}}}}
```


# Language

## Get supported languages from the Omnitron API

> Get supported languages from the Omnitron API

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/api/v1/languages/":{"get":{"summary":"Get supported languages from the Omnitron API","description":"Get supported languages from the Omnitron API","tags":["Language"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"languages":{"type":"object","additionalProperties":{"type":"string"}},"default_language":{"type":"string"}}}}}}}}}}}
```


# Content Types

## Retrieve Content Type

> Retrieve a specific Content Type by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/{id}/":{"get":{"summary":"Retrieve Content Type","description":"Retrieve a specific Content Type by ID","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Content Type retrieved successfully","content":{"application/json":{"schema":{"type":"object","$ref":"#/components/schemas/ContentType"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Content Type

> Update a specific Content Type by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/{id}/":{"put":{"summary":"Update Content Type","description":"Update a specific Content Type by ID","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentType"}}}},"responses":{"200":{"description":"Content Type updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Content Type

> Delete a specific Content Type by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/{id}/":{"delete":{"summary":"Delete Content Type","description":"Delete a specific Content Type by ID","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"description":"Content Type deleted successfully"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partial Update Content Type

> Partial update a specific Content Type by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/{id}/":{"patch":{"summary":"Partial Update Content Type","description":"Partial update a specific Content Type by ID","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentType"}}}},"responses":{"200":{"description":"Content Type updated"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Retrieve Content Type Fields

> Retrieve a specific Content Type by ID with its fields

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/{id}/fields/":{"get":{"summary":"Retrieve Content Type Fields","description":"Retrieve a specific Content Type by ID with its fields","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Content Type retrieved successfully with fields","content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"is_relation":{"type":"boolean"}}}},"related_fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"is_relation":{"type":"boolean"}}}},"many_to_many_fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"is_relation":{"type":"boolean"}}}}}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Content Types

> List Content Types

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"id":{"name":"id","in":"query","required":false,"description":"Filters by id","schema":{"type":"integer"}}},"schemas":{"ContentType":{"type":"object","properties":{"id":{"type":"integer","readOnly":true,"description":"Content Type ID"},"app_label":{"type":"string","description":"App label for the content type"},"model":{"type":"string","description":"Model for the content type"}},"required":["app_label","model"]}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/content_types/":{"get":{"summary":"List Content Types","description":"List Content Types","tags":["Content Types"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"List of Content Types","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ContentType"}}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```


# Mappings

## Retrieve a mapping

> Retrieve detailed information for a specific mapping by its ID.

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Mapping":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Mapping ID"},"mapping_type":{"type":"string","description":"Type of the mapping.","enum":["attribute","attribute_set","attribute_value"]},"input_kwargs":{"type":"object","description":"Input arguments in JSON format"},"output_kwargs":{"type":"object","description":"Output arguments in JSON format"},"priority":{"type":"integer","description":"Priority of the mapping"},"mapping_key":{"type":"string","description":"Key of the mapping"},"created_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was created"},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was last modified"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/{id}/":{"get":{"summary":"Retrieve a mapping","description":"Retrieve detailed information for a specific mapping by its ID.","tags":["Mappings"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"200":{"description":"Detailed information about the mapping.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Update Mapping

> Update an existing Mapping instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Mapping":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Mapping ID"},"mapping_type":{"type":"string","description":"Type of the mapping.","enum":["attribute","attribute_set","attribute_value"]},"input_kwargs":{"type":"object","description":"Input arguments in JSON format"},"output_kwargs":{"type":"object","description":"Output arguments in JSON format"},"priority":{"type":"integer","description":"Priority of the mapping"},"mapping_key":{"type":"string","description":"Key of the mapping"},"created_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was created"},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was last modified"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/{id}/":{"put":{"summary":"Update Mapping","description":"Update an existing Mapping instance by ID","tags":["Mappings"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"responses":{"200":{"description":"Mapping updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Delete Mapping

> Delete a specific Mapping instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"responses":{"204":{"description":"No content"},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/{id}/":{"delete":{"summary":"Delete Mapping","description":"Delete a specific Mapping instance by ID","tags":["Mappings"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"responses":{"204":{"$ref":"#/components/responses/204"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Partially Update Mapping

> Partially update an existing Mapping instance by ID

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"id_path":{"name":"id","in":"path","description":"Unique identifier of the resource","required":true,"schema":{"type":"integer"}}},"schemas":{"Mapping":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Mapping ID"},"mapping_type":{"type":"string","description":"Type of the mapping.","enum":["attribute","attribute_set","attribute_value"]},"input_kwargs":{"type":"object","description":"Input arguments in JSON format"},"output_kwargs":{"type":"object","description":"Output arguments in JSON format"},"priority":{"type":"integer","description":"Priority of the mapping"},"mapping_key":{"type":"string","description":"Key of the mapping"},"created_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was created"},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was last modified"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"404":{"description":"The given resource or object was not found or does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"description":"Contains a detailed description of the error.","type":"string"}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/{id}/":{"patch":{"summary":"Partially Update Mapping","description":"Partially update an existing Mapping instance by ID","tags":["Mappings"],"parameters":[{"$ref":"#/components/parameters/id_path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"responses":{"200":{"description":"Mapping updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"404":{"$ref":"#/components/responses/404"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## List Mappings

> List Mappings

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"parameters":{"page":{"name":"page","in":"query","required":false,"description":"Specifies the page number of the current dataset","schema":{"type":"integer","minimum":1,"default":1}},"limit":{"name":"limit","in":"query","required":false,"description":"Indicates the number of rows on the current page.","schema":{"type":"integer","minimum":1,"default":10}},"mapping_type":{"name":"mapping_type","in":"query","required":false,"description":"Filter by mapping type.","schema":{"type":"string","enum":["attribute","attribute_set","attribute_value"]}},"mapping_key":{"name":"mapping_key","in":"query","required":false,"description":"Filter by exact mapping key.","schema":{"type":"string"}},"input_kwargs__value_dict":{"name":"input_kwargs__value_dict","in":"query","required":false,"description":"Filter by input_kwargs value dictionary.","schema":{"type":"string"}},"output_kwargs__default_value":{"name":"output_kwargs__default_value","in":"query","required":false,"description":"Filter by output_kwargs default value.","schema":{"type":"string"}},"output_kwargs__default_attribute":{"name":"output_kwargs__default_attribute","in":"query","required":false,"description":"Filter by output_kwargs default attribute","schema":{"type":"string"}},"priority":{"name":"priority","in":"query","description":"Filter by priority","required":false,"schema":{"type":"integer"}}},"schemas":{"Mapping":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Mapping ID"},"mapping_type":{"type":"string","description":"Type of the mapping.","enum":["attribute","attribute_set","attribute_value"]},"input_kwargs":{"type":"object","description":"Input arguments in JSON format"},"output_kwargs":{"type":"object","description":"Output arguments in JSON format"},"priority":{"type":"integer","description":"Priority of the mapping"},"mapping_key":{"type":"string","description":"Key of the mapping"},"created_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was created"},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was last modified"}}}},"responses":{"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/":{"get":{"summary":"List Mappings","description":"List Mappings","tags":["Mappings"],"parameters":[{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/mapping_type"},{"$ref":"#/components/parameters/mapping_key"},{"$ref":"#/components/parameters/input_kwargs__value_dict"},{"$ref":"#/components/parameters/output_kwargs__default_value"},{"$ref":"#/components/parameters/output_kwargs__default_attribute"},{"$ref":"#/components/parameters/priority"}],"responses":{"200":{"description":"List of Mappings","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Mapping"}}}}},"401":{"$ref":"#/components/responses/401"},"500":{"$ref":"#/components/responses/500"}}}}}}
```

## Create a new Mapping

> Create a new Mapping instance

```json
{"openapi":"3.0.3","info":{"title":"Omnitron API","version":"1.0.0"},"security":[{"Token":[]}],"components":{"securitySchemes":{"Token":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"Mapping":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Mapping ID"},"mapping_type":{"type":"string","description":"Type of the mapping.","enum":["attribute","attribute_set","attribute_value"]},"input_kwargs":{"type":"object","description":"Input arguments in JSON format"},"output_kwargs":{"type":"object","description":"Output arguments in JSON format"},"priority":{"type":"integer","description":"Priority of the mapping"},"mapping_key":{"type":"string","description":"Key of the mapping"},"created_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was created"},"modified_date":{"type":"string","format":"date-time","description":"The date and time when the mapping object was last modified"}}}},"responses":{"400":{"description":"Required field(s) are missing, data is invalid, or the action is not allowed.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"field":{"oneOf":[{"type":"array","description":"Indicates that no value was provided for the {field} field in the request.","items":{"type":"string"}},{"type":"array","description":"Indicates usage of a non-existent object for {field} in the request.","items":{"type":"string"}}]},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"non_field_errors":{"description":"Indicates invalid data or action usage in the request.","type":"array","items":{"type":"string"}},"code":{"type":"string","description":"Represents the server-side error code."}}},{"type":"object","properties":{"detail":{"description":"Provides a detailed message for the given error.","type":"string"},"code":{"type":"string","description":"Represents the server-side error code."}}}]}}}},"401":{"description":"Unauthorized Access","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string","description":"Contains a detailed description of the error."},"code":{"type":"string","description":"Represents the server-side error code."}}}}}},"500":{"description":"Server Error"}}},"paths":{"/api/v1/mappings/":{"post":{"summary":"Create a new Mapping","description":"Create a new Mapping instance","tags":["Mappings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"responses":{"201":{"description":"Mapping created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mapping"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"500":{"$ref":"#/components/responses/500"}}}}}}
```




---

[Next Page](https://apidocs.akinon.com/llms-full.txt/1)

