# Order Log Services

All services related to order logs are listed in this document.

### `GET` Get Order Log

Returns API level details of OrderLog Get service.

**Path:** `/api/v1/oms/order-stock-info/`

**Query Parameters**

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

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

**Example Request**

To get API level details of the service, a `GET` request should be sent to\
the `/api/v1/oms/order-stock-info/` 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/order-stock-info/?order_number=<order-number>&erp_code=<stocklocation-erp_code"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"
payload = {}
headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Token {token}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.json())
```

**Example Response (200 OK)**

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

```json
{
  "count": 20,
  "next": "http://localhost:8000/api/v1/oms/order-stock-info/?erp_code=<erp_code>&order_number=<order-number>&page=2",
  "previous": null,
  "results": [
    {
      "date": "2024-01-01T12:18:49.469694Z",
      "order_item": {
        "pk": 1,
        "sku": "1",
        "omnitron_id": 1,
        "order_number": "111111111111"
      },
      "stock_data": {
        "quantity": "-5.00",
        "unit_type": "quantity",
        "stock_count": "1.00",
        "reservation_count": "6.00"
      }
    }
  ]
}
```

### The Story of the API

1. The API serves the purpose of retrieving stock information related to order items.
2. Response Data Information:
   * `quantity`: Indicates the quantity of the order item, which can be positive or negative. (Reservation\_count - Stock\_count = Quantity)
   * `stock_count`: Represents the stock count of the order item obtained from the brand's stock service or Integrator.
   * `reservation_count`: Denotes the reservation count of the order item, created to manage the sale of products without stock or those in certain statuses.
   * `unit_type`: Specifies the unit type of the order item.
   * `date`: Indicates the date of the created order execution plan.
3. When an order is received in the OMS, the API becomes invaluable, particularly when investigating package states indicating "out of stock". In such cases, it is crucial to examine the stock returns from locations and scenario rules. Detailed information regarding suitable scenarios can be found within the order details. If a package state is marked as "out of stock" despite available stock in certain locations, it's advisable to cross-check the locations specified in the scenario rules. Additionally, if the quantity displayed on the log page is zero, it is normal for the corresponding product to remain unpackaged, awaiting availability in relevant locations. By scrutinizing both the scenario rules and the quantity data, clearer insights can be gained into package formation issues or out-of-stock scenarios.


---

# 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/order-log-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.
