# Inventory Discrepancy Services

All services related to InventoryDiscrepancy are listed in this page.

### `GET` List InventoryDiscrepancy

This service is used to get a list of InventoryDiscrepancy.

**Path:** `/api/v1/oms/inventory-discrepancies/`

**Query Parameters**

The following query parameters can be used to get the list of InventoryDiscrepancy.

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

**Example Request**

To get list of InventoryDiscrepancy, a `GET` request should be sent to `/api/v1/oms/inventory-discrepancies/` endpoint. No query parameters or request body are required.

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

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/inventory-discrepancies/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_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 list of InventoryDiscrepancy information.

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

```json
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "reason": "out_of_stock",
            "created_date": "2023-01-01T14:09:34.934060Z",
            "modified_date": "2023-01-01T14:09:34.934069Z",
            "is_active": true,
            "stock_location": 1,
            "package_item": 11111,
            "transfer_item": null
        }
    ]
}
```

### `GET` Get InventoryDiscrepancy Detail

This service is used to get detail about InventoryDiscrepancy.

**Path:** `/api/v1/oms/inventory-discrepancies/<pk>`

**Query Parameters**

The following query parameters can be used to get detail about InventoryDiscrepancy.

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

**Example Request**

To get detail about InventoryDiscrepancy, a `GET` request should be sent to `/api/v1/oms/inventory-discrepancies/<pk>` endpoint. No query parameters or request body are required.

| Parameter       | Data Type | Description                                    |
| --------------- | --------- | ---------------------------------------------- |
| pk              | integer   | The ID of the discrepancy record               |
| reason          | string    | The reason type of the discrepancy record      |
| stock\_location | integer   | The location value of the discrepancy record   |
| is\_active      | boolean   | The status of the discrepancy record           |
| package\_item   | integer   | The Package Item id of the discrepancy record  |
| transfer\_item  | integer   | The Transfer Item id of the discrepancy record |

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

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/inventory-discrepancies/<pk>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
'Accept': 'application/json',
'Authorization': 'Token {}'.format(api_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 InventoryDiscrepancy detail.

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

```json
{
    "id": 1,
    "reason": "out_of_stock",
    "created_date": "2023-01-01T14:09:34.934060Z",
    "modified_date": "2023-01-01T14:09:34.934069Z",
    "is_active": true,
    "stock_location": 1,
    "package_item": 11111,
    "transfer_item": null
}

```

### `POST` Remove InventoryDiscrepancy

This service is used to remove an InventoryDiscrepancy record.

**Path:** `/api/v1/oms/inventory-discrepancies/remove/`

**Query Parameters**

The following query parameters can be used to remove an InventoryDiscrepancy.

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

**Example Request**

To remove an InventoryDiscrepancy, a `POST` request should be sent to `/api/v1/oms/inventory-discrepancies/remove/` endpoint.

| Parameter       | Data Type | Description                                                                 |
| --------------- | --------- | --------------------------------------------------------------------------- |
| expired\_date   | string    | The expired date deletes discrepancy records starting from the expired date |
| stock\_location | integer   | The stock location for remove discrepancy record                            |

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

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/inventory-discrepancies/remove/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

payload = {
    "expired_date": "10-10-2023"
}

# Another payload -> If you want to remove for one location.

payload = {'expired_date': "10-10-2023",
           'stock_location': <stock-location-pk> }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.json())
```

**Example Response (204 No Content)**

A successful response is returned with a status code of `204 NO-CONTENT`.
