# Blacklist Services

Products that are identified as problematic or non-packable are added to a blacklist. Once blacklisted, these products are automatically excluded from the packing process for any future orders.

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

This function retrieves a list of products that have been blacklisted.

**Path:** `/api/v1/oms/products/blacklist/`

#### **Example Request**

To get list of blacklists, a GET request should be sent to `/api/v1/oms/products/blacklist/` endpoint.

```python
import requests

url = "https://{oms_base_url}/api/v1/oms/products/blacklist/"
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 a list of blacklist information.

<table><thead><tr><th width="179.21484375">Parameter</th><th width="120.09765625">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Unique identifier for each blacklist record. Serves as the primary key in the blacklist table.</td></tr><tr><td>product</td><td>integer</td><td>The unique identifier (ID) of the product that has been blacklisted. This product will be excluded from the packaging process in future order fulfillment operations.</td></tr><tr><td>stock_location</td><td>integer</td><td>The ID of the specific stock location where the product is considered problematic or non-packable. Blacklisting is location-specific, meaning the same product may be available in other locations.</td></tr><tr><td>package_item</td><td>integer</td><td>The ID of the package item that triggered the blacklisting due to a failed or problematic packaging attempt. Used for traceability and audit purposes.</td></tr></tbody></table>

This example response serves as a reference to understand the structure and data format of blacklist list:

```json
{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 2,
            "product": 2,
            "stock_location": 2,
            "package_item": 3
        },
        {
            "id": 1,
            "product": 1,
            "stock_location": 1,
            "package_item": 1
        }
    ]
}

```

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

This method retrieves detailed information about a specific blacklist record.

**Path:** `/api/v1/oms/products/blacklist/{id}/`

#### **Example Request**

To get details of the blacklist, a GET request should be sent to `/api/v1/oms/products/blacklist/{id}` endpoint.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/products/blacklist/1/"
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 details of the blacklist record.

<table><thead><tr><th width="167.7890625">Parameter</th><th width="133.56640625">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Unique identifier for each blacklist record. Serves as the primary key in the blacklist table.</td></tr><tr><td>product</td><td>integer</td><td>The unique identifier (ID) of the product that has been blacklisted. This product will be excluded from the packaging process in future order fulfillment operations.</td></tr><tr><td>stock_location</td><td>integer</td><td>The ID of the specific stock location where the product is considered problematic or non-packable. Blacklisting is location-specific, meaning the same product may be available in other locations.</td></tr><tr><td>package_item</td><td>integer</td><td>The ID of the package item that triggered the blacklisting due to a failed or problematic packaging attempt. Used for traceability and audit purposes.</td></tr></tbody></table>

This example response serves as a reference to understand the structure and data format of blacklist record detail.

```json
{
    "id": 1,
    "product": 1,
    "stock_location": 1,
    "package_item": 1
}
```

### <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Create Blacklist</mark>

This method is used to create a new blacklist record for a product that has been identified as problematic or non-packable during the packaging process.

**Path:** `/api/v1/oms/products/blacklist/`

#### **Body Parameters**

<table><thead><tr><th width="160.203125">Parameter</th><th width="94.40625">Data Type</th><th width="91.86328125">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>product</code></td><td>integer</td><td>Yes</td><td>The unique ID of the product to be blacklisted. This product will be excluded from future packaging operations at the specified stock location.</td></tr><tr><td><code>package_item</code></td><td>integer</td><td>Yes</td><td>The ID of the package item that triggered the blacklist action, typically due to a packaging error or failure. Used for traceability and logging purposes.</td></tr><tr><td><code>stock_location</code></td><td>integer</td><td>Yes</td><td>The ID of the stock location where the product was found to be problematic or non-packable. The blacklist is scoped to this specific location.</td></tr></tbody></table>

#### **Example Request**

To create a blacklist, a POST request should be sent to `/api/v1/oms/products/blacklist/` endpoint.

```python

import requests

payload = {
  "product": 1,
  "stock_location": 1,
  "package_item": 1
}

url = "https://{oms_base_url}/api/v1/oms/products/blacklist/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

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

print(response.json())
```

#### **Example Response (201 Created)**

In a successful response with a status code of 201 Created, the API returns details of blacklist record.

<table><thead><tr><th width="152.22265625">Parameter</th><th width="126.55078125">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Unique identifier for each blacklist record. Serves as the primary key in the blacklist table.</td></tr><tr><td>product</td><td>integer</td><td>The unique identifier (ID) of the product that has been blacklisted. This product will be excluded from the packaging process in future order fulfillment operations.</td></tr><tr><td>stock_location</td><td>integer</td><td>The ID of the specific stock location where the product is considered problematic or non-packable. Blacklisting is location-specific, meaning the same product may be available in other locations.</td></tr><tr><td>package_item</td><td>integer</td><td>The ID of the package item that triggered the blacklisting due to a failed or problematic packaging attempt. Used for traceability and audit purposes.</td></tr></tbody></table>

This example response serves as a reference to understand the structure and data format of blacklist record detail.

```json
{
    "id": 1,
    "product": 1,
    "stock_location": 1,
    "package_item": 1
}
```

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

This method is used to update an existing blacklist record.

**Path:** `/api/v1/oms/products/blacklist/{id}`

#### **Example Request**

To update blacklist, a PATCH request should be sent to `/api/v1/oms/products/blacklist/{id}/` endpoint.

```python
import requests

payload = {
 "product": 1,
 "stock_location": 1,
 "package_item": 1
}

url = "https://{oms_base_url}/api/v1/oms/products/blacklist/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

response = requests.request("PATCH", url, headers=headers, json=payload)

print(response.json())
```

#### **Example Response (200 OK)**

In a successful response with a status code of 200 OK, the API returns an updated blacklist record.

<table><thead><tr><th width="145.30859375">Parameter</th><th width="107.078125">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Unique identifier for each blacklist record. Serves as the primary key in the blacklist table.</td></tr><tr><td>product</td><td>integer</td><td>The unique identifier (ID) of the product that has been blacklisted. This product will be excluded from the packaging process in future order fulfillment operations.</td></tr><tr><td>stock_location</td><td>integer</td><td>The ID of the specific stock location where the product is considered problematic or non-packable. Blacklisting is location-specific, meaning the same product may be available in other locations.</td></tr><tr><td>package_item</td><td>integer</td><td>The ID of the package item that triggered the blacklisting due to a failed or problematic packaging attempt. Used for traceability and audit purposes.</td></tr></tbody></table>

This example response serves as a reference to understand the structure and data format of blacklist record detail.

```json
{
            "id": 1,
            "product": 1,
            "stock_location": 1,
            "package_item": 1
}
```

### <mark style="color:red;">`DELETE`</mark> <mark style="color:red;"></mark><mark style="color:red;">Delete Blacklist</mark>

This method is used to delete a blacklist.

**Path:** `/api/v1/oms/products/blacklist/{id}/`

#### **Example Request**

To delete the blacklist, a DELETE request should be sent to `/api/v1/oms/products/blacklist/{id}` endpoint.

```python

import requests

url = "https://{oms_base_url}/api/v1/oms/products/blacklist/1/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

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

response = requests.request("DELETE", url, headers=headers)

print(response.json())
```

#### **Example Response (204 No Content)**

In a successful response with a status code of 204 No Content, the API returns with an empty body.
