# Cargo Company Condition Services

All services that give information about cargo company conditions are listed in this document.

### `GET` Cargo Company Condition List

Returns all cargo company conditions.

**Path:** `/api/v1/oms/cargo-company-conditions/`

**Query Parameters**

The following query parameters can be used to get the information about\
cargo company conditions.

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

**Example Request**

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

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

```python
import requests

url = "https://{domain_url}/api/v1/oms/cargo-company-conditions/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns all the\
cargo company conditions. The response body contains a `JSON` object with\
the cargo company conditions and their attributes such as ID, cargo\_company and\
rules\_configuration.

These attributes are described in the following table.

| Parameter            | Data Type | Description                                 |
| -------------------- | --------- | ------------------------------------------- |
| id                   | integer   | The ID of the condition                     |
| cargo\_company       | integer   | The cargo company id of the condition       |
| rules\_configuration | dict      | The configuration settings of the condition |

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

```json
{
  "count": 21,
  "next": "https://{domain_url}/api/v1/oms/cargo-company-conditions/?page=2",
  "previous": null,
  "results": [
    {
      "id": 233,
      "rules_configuration": {
        "rules": []
      },
      "cargo_company": 695
    },
    {
      "id": 232,
      "rules_configuration": {
        "rules": []
      },
      "cargo_company": 694
    },
    {
      "id": 200,
      "rules_configuration": {
        "rules": [
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClient",
                "query_url": "https://www.aaa.com"
              },
              "channels": [
                "1"
              ],
              "condition_type": "trendyol"
            }
          },
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClient",
                "query_url": "https://www.aaa.com"
              },
              "channels": [
                "34"
              ],
              "condition_type": "trendyol"
            }
          }
        ]
      },
      "cargo_company": 661
    },
    {
      "id": 199,
      "rules_configuration": {
        "rules": [
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClient",
                "query_url": "https://www.aaa.com"
              },
              "channels": [
                "1"
              ],
              "condition_type": "trendyol"
            }
          },
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClientWithoutLabelFile",
                "query_url": "https://www.bbb.com"
              },
              "channels": [
                "34"
              ],
              "condition_type": "trendyol"
            }
          }
        ]
      },
      "cargo_company": 628
    },
    {
      "id": 166,
      "rules_configuration": {
        "rules": [
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "api_key": "asd",
                "api_secret": "asdasd",
                "supplier_id": "123123",
                "package_number_format_length": 10,
                "query_url": "https://deneme.com"
              },
              "channels": [
                1
              ],
              "condition_type": "trendyol"
            }
          }
        ]
      },
      "cargo_company": 463
    },
    {
      "id": 133,
      "rules_configuration": {
        "rules": [
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClientWithoutLabelFile",
                "query_url": "https://denemet.cmm"
              },
              "channels": [
                "1"
              ],
              "condition_type": "trendyol"
            }
          }
        ]
      },
      "cargo_company": 595
    },
    {
      "id": 100,
      "rules_configuration": {
        "rules": []
      },
      "cargo_company": 562
    },
    {
      "id": 67,
      "rules_configuration": {
        "rules": []
      },
      "cargo_company": 496
    },
    {
      "id": 34,
      "rules_configuration": {
        "rules": [
          {
            "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
            "params": {
              "conf": {
                "klass": "oms.shipments.clients.demo_client.DemoShipmentClient",
                "query_url": "https://deneme.com"
              },
              "channels": [
                "1"
              ],
              "condition_type": "trendyol"
            }
          }
        ]
      },
      "cargo_company": 265
    },
    {
      "id": 5,
      "rules_configuration": {
        "rules": []
      },
      "cargo_company": 235
    }
  ]
}
```

### `GET` Cargo Company Condition Retrieve

Returns the information of the given cargo company condition with id.

**Path:** `/api/v1/oms/cargo-company-conditions/{id}/`

**Query Parameters**

The following query parameters can be used to get the information about\
cargo company conditions.

| Parameter | Data Type | In     | Description                           |
| --------- | --------- | ------ | ------------------------------------- |
| token     | string    | header | The API key of the customer account   |
| {id}      | integer   | url    | The ID of the cargo company condition |

**Example Request**

To retrieve information of given cargo company condition, a `GET` request\
should be sent to the `/api/v1/oms/cargo-company-conditions/{id}/`\
endpoint. Here's an example of how to make the request in python:

```python
import requests

url = "https://{domain_url}/api/v1/oms/cargo-company-conditions/{id}/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of 200 OK, the API returns the\
information of given cargo company condition. The response body contains\
a `JSON` object with the cargo company conditions and their attributes such as\
ID, cargo\_company and rules\_configuration.\
These attributes are described in the following table.

| Parameter            | Data Type | Description                                 |
| -------------------- | --------- | ------------------------------------------- |
| id                   | integer   | The ID of the condition                     |
| cargo\_company       | integer   | The cargo company id of the condition       |
| rules\_configuration | dict      | The configuration settings of the condition |

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

```json
{
  "id": 859,
  "rules_configuration": {
    "rules": [
      {
        "klass": "oms.shipments.shipment_conditions.ClickAndCollectTransferCondition",
        "params": {
          "conf": {},
          "channels": [],
          "condition_type": "sales_channel"
        }
      }
    ]
  },
  "cargo_company": 1123
}
```

### `GET` Available Cargo Company Conditions

Returns all cargo company condition types in the system.

**Path:** `/api/v1/oms/cargo-company-conditions/available-cargo-company-conditions/`

**Query Parameters**

The following query parameters can be used to get the information about\
condition types.

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

**Example Request**

To get a list of condition types, a `GET` request should be sent to\
the `/api/v1/oms/cargo-company-conditions/available-cargo-company-conditions/`\
endpoint. In the headers, set the `Authorization` header to include the token\
for authentication.

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

```python
import requests

url = "https://{domain_url}/api/v1/oms/cargo-company-conditions/available-cargo-company-conditions/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns\
condition types in the system. The response body contains a `JSON` object of\
condition types and their attributes such as slug, label, klass and\
parameter\_type.

These attributes are described in the following table.

| Parameter       | Data Type | Description                                 |
| --------------- | --------- | ------------------------------------------- |
| slug            | string    | The unique value of the condition           |
| label           | string    | The name of the condition                   |
| klass           | string    | The configuration class of the condition    |
| parameter\_type | string    | According to what is the condition checked? |

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

```json
[
  {
    "slug": "ONLY_CLICK_AND_COLLECT_TRANSFERS",
    "label": "Click And Collect Transfers",
    "klass": "oms.shipments.shipment_conditions.ClickAndCollectTransferCondition",
    "parameter_type": null
  },
  {
    "slug": "CHANNEL_BASED_ORDERS",
    "label": "Channel Based Orders",
    "klass": "oms.shipments.shipment_conditions.ChannelBasedOrdersCondition",
    "parameter_type": "channel"
  }
]
```

### `GET` Sales Channels

Returns all marketplace applications available for this usage.

**Path:** `/api/v1/oms/cargo-company-conditions/cargo_companies/`

**Query Parameters**

The following query parameters can be used to get the information about\
sales channels.

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

**Example Request**

To get a list of marketplace applications, a `GET` request should be sent to\
the `/api/v1/oms/cargo-company-conditions/cargo_companies/`\
endpoint. In the headers, set the `Authorization` header to include the token\
for authentication.

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

```python
import requests

url = "https://{domain_url}/api/v1/oms/cargo-company-conditions/cargo_companies/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns\
marketplace applications available for this usage. The response body contains a\
Python dictionary of sales channels in `key-value` format.

This data is consistent for all users.

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

```json
{
  "sales_channel": "Sales Channel",
  "turkcellds": "Turkcell Dropshipment",
  "pazarama": "Pazarama",
  "gordumaldim": "Gördüm Aldım",
  "ciceksepeti": "Cicek Sepeti",
  "emag": "eMAG",
  "aliexpress": "AliExpress",
  "distributed": "Distributed",
  "allegro": "Allegro",
  "amazon": "Amazon",
  "lidyana": "Lidyana",
  "morhipoV2": "Morhipo V2",
  "morhipo": "Morhipo",
  "trendyol": "Trendyol",
  "feed": "Feed",
  "n11": "n11",
  "gittigidiyor": "GittiGidiyor",
  "hepsiburada": "Hepsiburada",
  "cargo_company": "Cargo Company"
}
```

### `GET` Cargo Company Fields

Returns configuration fields of the given value.

**Path:** `/api/v1/oms/cargo-company-conditions/cargo_company_fields/`

**Query Parameters**

The following query parameters can be used to get the information about the\
configuration fields.

| Parameter       | Data Type | In              | Description                                           |
| --------------- | --------- | --------------- | ----------------------------------------------------- |
| token           | string    | header          | The API key of the customer account                   |
| condition\_type | string    | query parameter | One of the sales channel value given above (required) |

**Example Request**

To get the configuration fields of the given value, a `GET` request should be\
sent to the `/api/v1/oms/cargo-company-conditions/cargo_company_fields/?condition_type=<value>`\
endpoint. In the headers, set the `Authorization` header to include the token\
for authentication.

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

```python
import requests

url = "https://{domain_url}/api/v1/oms/cargo-company-conditions/cargo_company_fields/?condition_type=<value>"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())

```

**Example Response (200 OK)**

In a successful response with a status code of `200 OK`, the API returns the\
configuration fields of the given value.The response body contains\
a `JSON` object, which varies from one value to another.

This is an example of the response for the `trendyol`:

**Path:** `/api/v1/oms/cargo-company-conditions/cargo_company_fields/?condition_type=trendyol`

```json
{
  "api_key": {
    "type": "string",
    "required": true,
    "read_only": false,
    "label": "Api key"
  },
  "api_secret": {
    "type": "string",
    "required": true,
    "read_only": false,
    "label": "Api secret"
  },
  "supplier_id": {
    "type": "string",
    "required": true,
    "read_only": false,
    "label": "Supplier id"
  },
  "query_url": {
    "type": "url",
    "required": true,
    "read_only": false,
    "label": "Query url"
  },
  "package_number_format_length": {
    "type": "integer",
    "required": false,
    "read_only": false,
    "label": "Package number format length",
    "min_value": 1
  }
}
```

This is an example of the response for the `cargo_company` :

**Path:** `/api/v1/oms/cargo-company-conditions/cargo_company_fields/?condition_type=cargo_company`

```json
{
  "cargo_company_id": {
    "type": "integer",
    "required": true,
    "read_only": false,
    "label": "Cargo company id"
  }
}
```

This is an example of the response for the `n11` :

**Path:** `/api/v1/oms/cargo-company-conditions/cargo_company_fields/?condition_type=n11`

```json
{}
```

The API response indicates that there are no configurable settings associated with the `n11` value.


---

# Agent Instructions: Querying This Documentation

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

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

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

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

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