# Staff Services

Staff members are accounts created for staff members who perform operations in instore retail locations.

This document provides detailed information on the services available for managing staff within the system. It outlines how to retrieve a list of all staff members, including their personal and operational details such as name, email, active status, assigned retail stores, and more. The document also includes example requests and responses to help users understand the structure of the data and how to interact with the API for staff management.

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

Returns all staff with detailed information.

**Path:** `/api/v1/staffs/`

**Headers:**

<table><thead><tr><th width="119.8984375">Parameter</th><th width="130.10546875">Data Type</th><th width="121.171875">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>The API token of the customer account</td></tr></tbody></table>

#### **Example Request**

To get a detailed list of all staffs, a `GET` request should be sent to the `/api/v1/staffs/` 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/staffs/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': '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 details of all staff. The response body contains a `JSON` object with the staffs and their attributes such as ID, retail store list, first name, last name, email etc. These parameters are described in the following table.

<table><thead><tr><th width="165.08203125">Parameter</th><th width="90.7578125">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>A unique identifier assigned to the staff record in the system.</td></tr><tr><td>retail_stores</td><td>list</td><td>A list of retail stores to which the staff member is assigned or registered.</td></tr><tr><td>first_name</td><td>string</td><td>The given name of the staff member.</td></tr><tr><td>last_name</td><td>string</td><td>The family name or surname of the staff member.</td></tr><tr><td>username</td><td>string</td><td>The system login name used by the staff member for authentication.</td></tr><tr><td>email</td><td>string</td><td>The staff member’s email address is used for communication and identification.</td></tr><tr><td>is_active</td><td>boolean</td><td>Indicates whether the staff member’s account is currently active.</td></tr><tr><td>remote_id</td><td>string</td><td>An external unique identifier used to sync staff data across systems.</td></tr><tr><td>is_superuser</td><td>boolean</td><td>Indicates whether the staff member has full administrative privileges.</td></tr><tr><td>is_staff</td><td>boolean</td><td>Specifies if the user has staff-level access rights in the system.</td></tr><tr><td>last_login</td><td>date</td><td>The most recent date and time the staff member successfully logged into the system.</td></tr><tr><td>date_joined</td><td>date</td><td>The date when the staff member's account was initially created.</td></tr><tr><td>created_at</td><td>date</td><td>The timestamp indicates when the staff record was created in the database.</td></tr><tr><td>modified_date</td><td>date</td><td>The most recent date and time the staff record was updated.</td></tr><tr><td>permission_groups</td><td>list</td><td>A list of permission group identifiers assigned to the staff member.</td></tr><tr><td>current_store</td><td>dict</td><td>Detailed information about the store where the staff member is currently logged in.</td></tr></tbody></table>

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

```json
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 8,
      "retail_stores": [
        {
          "id": 2,
          "address": {
            "id": 2,
            "township": {
              "id": 3,
              "city": {
                "id": 2,
                "created_date": "2022-07-27T07:05:04.685806Z",
                "modified_date": "2022-07-27T07:05:04.685832Z",
                "omnitron_id": 2,
                "name": "Test City 2",
                "country": 1
              },
              "created_date": "2022-07-27T07:05:04.690712Z",
              "modified_date": "2022-07-27T07:05:04.690732Z",
              "omnitron_id": 16,
              "name": "Test Township 3"
            },
            "created_date": "2022-07-27T07:05:04.870323Z",
            "modified_date": "2022-11-09T11:00:06.420534Z",
            "phone_number": "+32043843443",
            "line": "Shop 2 Address",
            "postcode": null,
            "retail_store": 2
          },
          "created_date": "2022-07-27T07:05:04.694591Z",
          "modified_date": "2023-12-31T01:11:15.761210Z",
          "omnitron_id": 2,
          "name": "Shop 2",
          "email": "shop2@akinon.com",
          "remote_id": "shop2",
          "is_active": true,
          "fast_delivery":false
        }
      ],
      "last_login": null,
      "is_superuser": false,
      "is_staff": false,
      "date_joined": "2022-12-29T08:09:46.853519Z",
      "created_date": "2022-12-29T08:09:46.853864Z",
      "modified_date": "2024-06-07T12:03:46.529654Z",
      "first_name": "test_staff",
      "last_name": "test_staff",
      "email": "test_staff_445566@akinon.com",
      "is_active": true,
      "remote_id": "akinonteststaff2233",
      "username": null,
      "permission_groups": [
        11,
        1
      ],
      "current_store": null
    },
    {
      "id": 68,
      "retail_stores": [
        {
          "id": 3,
          "address": {
            "id": 3,
            "township": {
              "id": 4,
              "city": {
                "id": 4,
                "created_date": "2022-07-27T07:05:05.421133Z",
                "modified_date": "2022-07-27T07:05:05.421157Z",
                "omnitron_id": 40,
                "name": "Test City 3",
                "country": 1
              },
              "created_date": "2022-07-27T07:05:05.656125Z",
              "modified_date": "2022-07-27T07:05:05.656152Z",
              "omnitron_id": 485,
              "name": "Test Township 4"
            },
            "created_date": "2022-07-27T07:05:05.070129Z",
            "modified_date": "2023-10-09T09:12:07.865480Z",
            "phone_number": "5412367750",
            "line": "Warehouse Test Address",
            "postcode": null,
            "retail_store": 3
          },
          "created_date": "2022-07-27T07:05:04.893041Z",
          "modified_date": "2023-10-09T09:12:07.860182Z",
          "omnitron_id": 3,
          "name": "Local Warehouse A",
          "email": "shop3@akinon.com",
          "remote_id": "shop3",
          "is_active": true,
          "fast_delivery": false
        },
        {
          "id": 5,
          "address": {
            "id": 5,
            "township": {
              "id": 4,
              "city": {
                "id": 4,
                "created_date": "2022-07-27T07:05:05.421133Z",
                "modified_date": "2022-07-27T07:05:05.421157Z",
                "omnitron_id": 40,
                "name": "Test City 3",
                "country": 1
              },
              "created_date": "2022-07-27T07:05:05.656125Z",
              "modified_date": "2022-07-27T07:05:05.656152Z",
              "omnitron_id": 485,
              "name": "Test Township 4"
            },
            "created_date": "2022-10-06T13:28:07.692723Z",
            "modified_date": "2022-11-10T07:36:29.808963Z",
            "phone_number": "02163996044",
            "line": "Warehouse test address",
            "postcode": null,
            "retail_store": 5
          },
          "created_date": "2022-10-06T13:28:07.614615Z",
          "modified_date": "2023-10-09T09:21:21.414688Z",
          "omnitron_id": 69,
          "name": "Local Warehouse B",
          "email": "shop4@akinon.com",
          "remote_id": "shop4",
          "is_active": true,
          "fast_delivery": false
        }
      ],
      "last_login": "2024-09-01T21:52:25.399023Z",
      "is_superuser": false,
      "is_staff": false,
      "date_joined": "2024-09-01T20:21:37.015406Z",
      "created_date": "2024-09-01T20:21:37.015708Z",
      "modified_date": "2024-09-01T21:52:25.399133Z",
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@akinon.com",
      "is_active": true,
      "remote_id": "3333",
      "username": null,
      "permission_groups": [
        1
      ],
      "current_store": null
    }
  ]
}
```

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

This method is used to get detailed information of a single staff member with an ID.

**Path:** `/api/v1/staffs/{id}/`

**Headers:**

<table><thead><tr><th width="123.32421875">Parameter</th><th width="120.1328125">Data Type</th><th width="109.265625">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>The API key of the customer account</td></tr></tbody></table>

**Query Parameter:**

<table><thead><tr><th width="125.54296875">Parameter</th><th width="115.02734375">Data Type</th><th width="131.078125">In</th><th>Description</th></tr></thead><tbody><tr><td>{id}</td><td>integer</td><td>URL</td><td>The ID of the staff</td></tr></tbody></table>

#### **Example Request**

To retrieve detailed information of given staff, a `GET` request should be sent to the `/api/v1/staffs/{id}/` 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/staffs/{id}/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization':'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 detailed information of given staff. The response body contains a `JSON` object with the given staffs' attributes such as ID, retail store list, first name, last name, email etc.

These parameters are described in the following table:

<table><thead><tr><th width="160.72265625">Parameter</th><th width="117.75390625">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>A unique identifier assigned to the staff record in the system.</td></tr><tr><td>retail_stores</td><td>list</td><td>A list of retail stores to which the staff member is assigned or registered.</td></tr><tr><td>first_name</td><td>string</td><td>The given name of the staff member.</td></tr><tr><td>last_name</td><td>string</td><td>The family name or surname of the staff member.</td></tr><tr><td>username</td><td>string</td><td>The system login name used by the staff member for authentication.</td></tr><tr><td>email</td><td>string</td><td>The staff member’s email address is used for communication and identification.</td></tr><tr><td>is_active</td><td>boolean</td><td>Indicates whether the staff member’s account is currently active.</td></tr><tr><td>remote_id</td><td>string</td><td>An external unique identifier used to sync staff data across systems.</td></tr><tr><td>is_superuser</td><td>boolean</td><td>Indicates whether the staff member has full administrative privileges.</td></tr><tr><td>is_staff</td><td>boolean</td><td>Specifies if the user has staff-level access rights in the system.</td></tr><tr><td>last_login</td><td>date</td><td>The most recent date and time the staff member successfully logged into the system.</td></tr><tr><td>date_joined</td><td>date</td><td>The date when the staff member's account was initially created.</td></tr><tr><td>created_at</td><td>date</td><td>The timestamp indicates when the staff record was created in the database.</td></tr><tr><td>modified_date</td><td>date</td><td>The most recent date and time the staff record was updated.</td></tr><tr><td>permission_groups</td><td>list</td><td>A list of permission group identifiers assigned to the staff member.</td></tr><tr><td>current_store</td><td>dict</td><td>Detailed information about the store where the staff member is currently logged in.</td></tr></tbody></table>

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

```json
{
  "id": 68,
  "retail_stores": [
    {
      "id": 3,
      "address": {
        "id": 3,
        "township": {
          "id": 4,
          "city": {
            "id": 4,
            "created_date": "2022-07-27T07:05:05.421133Z",
            "modified_date": "2022-07-27T07:05:05.421157Z",
            "omnitron_id": 40,
            "name": "Test City 3",
            "country": 1
          },
          "created_date": "2022-07-27T07:05:05.656125Z",
          "modified_date": "2022-07-27T07:05:05.656152Z",
          "omnitron_id": 485,
          "name": "Test Township 4"
        },
        "created_date": "2022-07-27T07:05:05.070129Z",
        "modified_date": "2023-10-09T09:12:07.865480Z",
        "phone_number": "5412367750",
        "line": "Warehouse Test Address",
        "postcode": null,
        "retail_store": 3
      },
      "created_date": "2022-07-27T07:05:04.893041Z",
      "modified_date": "2023-10-09T09:12:07.860182Z",
      "omnitron_id": 3,
      "name": "Local Warehouse A",
      "email": "shop3@akinon.com",
      "remote_id": "shop3",
      "is_active": true,
      "fast_delivery": false
    },
    {
      "id": 5,
      "address": {
        "id": 5,
        "township": {
          "id": 4,
          "city": {
            "id": 4,
            "created_date": "2022-07-27T07:05:05.421133Z",
            "modified_date": "2022-07-27T07:05:05.421157Z",
            "omnitron_id": 40,
            "name": "Test City 3",
            "country": 1
          },
          "created_date": "2022-07-27T07:05:05.656125Z",
          "modified_date": "2022-07-27T07:05:05.656152Z",
          "omnitron_id": 485,
          "name": "Test Township 4"
        },
        "created_date": "2022-10-06T13:28:07.692723Z",
        "modified_date": "2022-11-10T07:36:29.808963Z",
        "phone_number": "02163996044",
        "line": "Warehouse test address",
        "postcode": null,
        "retail_store": 5
      },
      "created_date": "2022-10-06T13:28:07.614615Z",
      "modified_date": "2023-10-09T09:21:21.414688Z",
      "omnitron_id": 69,
      "name": "Local Warehouse B",
      "email": "shop4@akinon.com",
      "remote_id": "shop4",
      "is_active": true,
      "fast_delivery": false
    }
  ],
  "last_login": "2024-09-01T21:52:25.399023Z",
  "is_superuser": false,
  "is_staff": false,
  "date_joined": "2024-09-01T20:21:37.015406Z",
  "created_date": "2024-09-01T20:21:37.015708Z",
  "modified_date": "2024-09-01T21:56:43.838189Z",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@akinon.com",
  "is_active": true,
  "remote_id": "3333",
  "username": null,
  "permission_groups": [
    1
  ],
  "current_store": null
}
```

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

This service is used to create staff with the request body parameters.

**Path:** `/api/v1/staffs/`

**Headers:**

<table><thead><tr><th width="127.0859375">Parameter</th><th width="120.015625">Data Type</th><th width="116.3671875">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>The API key of the customer account</td></tr></tbody></table>

#### **Body Parameters**

The following request body parameters can be used to create staff.

<table><thead><tr><th width="116.1484375">Parameter</th><th width="91.62890625">Data Type</th><th width="81.58984375">Required</th><th>Description</th></tr></thead><tbody><tr><td>retail_stores</td><td>list</td><td>Yes</td><td>A list of retail store IDs where the staff member will be registered or assigned.</td></tr><tr><td>first_name</td><td>string</td><td>Yes</td><td>The given name of the staff member to be created.</td></tr><tr><td>last_name</td><td>string</td><td>Yes</td><td>The surname of the staff member to be created.</td></tr><tr><td>email</td><td>string</td><td>Yes</td><td>The email address of the staff member, used for identification and communication.</td></tr><tr><td>password</td><td>string</td><td>Yes</td><td>The password to be used for the staff member's account authentication.</td></tr><tr><td>is_active</td><td>boolean</td><td>No</td><td>Indicates whether the staff account is currently active or disabled.</td></tr><tr><td>remote_id</td><td>string</td><td>Yes</td><td>A unique external identifier used to track or sync the staff member across integrated sys_</td></tr></tbody></table>

**Example Request**

To create a staff, a `POST` request should be sent to the `/api/v1/staffs/` endpoint.

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

```python
import requests
import json

url = "https://{domain_url}/api/v1/staffs/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
    "retail_stores": [3, 5, 37],
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@akinon.com",
    "password": "12345",
    "is_active": True,
    "remote_id": "1",
    "permission_groups": [1, 2, 3]
})

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

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

print(response.json())

```

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

In a successful response with a status code of 201 Created, the API indicates that a new staff has been successfully created.The response body contains a JSON object representing the newly created staff including its attributes such as retail stores, first name, last name etc.

### <mark style="color:red;">`PUT`</mark> <mark style="color:red;">Update Staff</mark>

This service is used to update staff with the request body.

**Path:** `/api/v1/staffs/{id}/`

**Headers:**

<table><thead><tr><th width="113.3359375">Parameter</th><th width="109.30859375">Data Type</th><th width="117.90234375">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>A secure API key used to authenticate and authorize the customer's request.</td></tr></tbody></table>

#### **Body Parameters**

The following request body parameters can be used to update staff.

<table><thead><tr><th width="131.1171875">Parameter</th><th width="103.9609375">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>retail_stores</td><td>list</td><td>A list of retail store IDs where the staff member is assigned or registered.</td></tr><tr><td>first_name</td><td>string</td><td>The given name of the staff member being created or updated.</td></tr><tr><td>last_name</td><td>string</td><td>The surname of the staff member being created or updated.</td></tr><tr><td>email</td><td>string</td><td>The staff member's email address, used for communication and login.</td></tr><tr><td>is_active</td><td>boolean</td><td>Indicates whether the staff member's account is currently active.</td></tr><tr><td>remote_id</td><td>string</td><td>A unique external identifier used to sync staff data across systems.</td></tr><tr><td>username</td><td>string</td><td>The system login username for the staff member.</td></tr><tr><td>is_staff</td><td>boolean</td><td>Specifies if the user has staff privileges within the system.</td></tr></tbody></table>

#### **Example Request**

To update a staff, a `PUT` request should be sent to the `/api/v1/staffs/{id}/` endpoint.\
Here's an example of how to make the request in python:

```python
import requests
import json

url = "https://{domain_url}/api/v1/staffs/{id}/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
    "retail_stores": [3, 5, 37],
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@akinon.com",
    "is_active": True
})

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

response = requests.request('PUT', url, headers=headers, data=payload)

print(response.json())

```

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

In a successful response with a status code of 200 OK, the API indicates that the staff has been successfully updated. The response body contains a JSON object representing the newly updated staff, including its attributes such as retail stores, first name, last name etc.

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

This service is used to partially update staff with the request body.

**Path:** `/api/v1/staffs/{id}/`

**Headers:**

<table><thead><tr><th width="113.76953125">Parameter</th><th width="94.26171875">Data Type</th><th width="92.734375">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>The API key of the customer account</td></tr></tbody></table>

#### **Body Parameters**

The following request body parameters can be used to update a staff. Only the fields to be updated should be sent in the request body.

<table><thead><tr><th width="125.24609375">Parameter</th><th width="104.4453125">Data Type</th><th width="83.85546875">In</th><th>Description</th></tr></thead><tbody><tr><td>retail_stores</td><td>list</td><td>body</td><td>The list of retail stores where staff is registered</td></tr></tbody></table>

#### **Example Request**

To update a field of staff, a `PATCH` request should be sent to the`/api/v1/staffs/{id}/` endpoint.

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

```python
import requests
import json

url = "https://{domain_url}/api/v1/staffs/{id}/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

payload = json.dumps({
    "retail_stores": [3, 5, 37]
})

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

response = requests.request('PATCH', url, headers=headers, data=payload)

print(response.json())

```

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

In a successful response with a status code of 200 OK, the API indicates that the staff has been successfully updated. The response body contains a JSON object representing the newly updated staff, including its attributes such as retail stores, first name, last name etc.

### <mark style="color:red;">`DELETE`</mark> <mark style="color:red;">Deactivate Staff</mark>

This service is used to deactivate given staff. Deactivated staff are not able to login to the system.

**Path:** `/api/v1/staffs/{id}/`

**Headers:**

<table><thead><tr><th width="96.1640625">Parameter</th><th width="111.25">Data Type</th><th width="96.234375">In</th><th>Description</th></tr></thead><tbody><tr><td>token</td><td>string</td><td>header</td><td>The API key of the customer account</td></tr></tbody></table>

#### **Example Request**

To deactivate a staff, a `DELETE` request should be sent to the `/api/v1/staffs/{id}/` endpoint.

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

```python
import requests
import json

url = "https://{instore_url}/api/v1/staffs/{id}/"
token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d"

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Token {}'.format(token)
}

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

print(response.text)
```

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

In a successful response with a status code of 204 No Content, the API returns no content. The response body does not contain any text or object.


---

# 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/staff-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.
