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.

GET List All Staff

Returns all staff with detailed information.

Path: /api/v1/staffs/

Headers:

Parameter
Data Type
In
Description

token

string

header

The API token of the customer account

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:

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.

Parameter
Data Type
Description

id

integer

A unique identifier assigned to the staff record in the system.

retail_stores

list

A list of retail stores to which the staff member is assigned or registered.

first_name

string

The given name of the staff member.

last_name

string

The family name or surname of the staff member.

username

string

The system login name used by the staff member for authentication.

email

string

The staff member’s email address is used for communication and identification.

is_active

boolean

Indicates whether the staff member’s account is currently active.

remote_id

string

An external unique identifier used to sync staff data across systems.

is_superuser

boolean

Indicates whether the staff member has full administrative privileges.

is_staff

boolean

Specifies if the user has staff-level access rights in the system.

last_login

date

The most recent date and time the staff member successfully logged into the system.

date_joined

date

The date when the staff member's account was initially created.

created_at

date

The timestamp indicates when the staff record was created in the database.

modified_date

date

The most recent date and time the staff record was updated.

permission_groups

list

A list of permission group identifiers assigned to the staff member.

current_store

dict

Detailed information about the store where the staff member is currently logged in.

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

{
  "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": "[email protected]",
          "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": "[email protected]",
      "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": "[email protected]",
          "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": "[email protected]",
          "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": "[email protected]",
      "is_active": true,
      "remote_id": "3333",
      "username": null,
      "permission_groups": [
        1
      ],
      "current_store": null
    }
  ]
}

GET Retrieve Staff

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

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

Headers:

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Query Parameter:

Parameter
Data Type
In
Description

{id}

integer

URL

The ID of the staff

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:

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:

Parameter
Data Type
Description

id

integer

A unique identifier assigned to the staff record in the system.

retail_stores

list

A list of retail stores to which the staff member is assigned or registered.

first_name

string

The given name of the staff member.

last_name

string

The family name or surname of the staff member.

username

string

The system login name used by the staff member for authentication.

email

string

The staff member’s email address is used for communication and identification.

is_active

boolean

Indicates whether the staff member’s account is currently active.

remote_id

string

An external unique identifier used to sync staff data across systems.

is_superuser

boolean

Indicates whether the staff member has full administrative privileges.

is_staff

boolean

Specifies if the user has staff-level access rights in the system.

last_login

date

The most recent date and time the staff member successfully logged into the system.

date_joined

date

The date when the staff member's account was initially created.

created_at

date

The timestamp indicates when the staff record was created in the database.

modified_date

date

The most recent date and time the staff record was updated.

permission_groups

list

A list of permission group identifiers assigned to the staff member.

current_store

dict

Detailed information about the store where the staff member is currently logged in.

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

{
  "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": "[email protected]",
      "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": "[email protected]",
      "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": "[email protected]",
  "is_active": true,
  "remote_id": "3333",
  "username": null,
  "permission_groups": [
    1
  ],
  "current_store": null
}

POST Create Staff

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

Path: /api/v1/staffs/

Headers:

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Body Parameters

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

Parameter
Data Type
Required
Description

retail_stores

list

Yes

A list of retail store IDs where the staff member will be registered or assigned.

first_name

string

Yes

The given name of the staff member to be created.

last_name

string

Yes

The surname of the staff member to be created.

email

string

Yes

The email address of the staff member, used for identification and communication.

password

string

Yes

The password to be used for the staff member's account authentication.

is_active

boolean

No

Indicates whether the staff account is currently active or disabled.

remote_id

string

Yes

A unique external identifier used to track or sync the staff member across integrated sys_

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:

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": "[email protected]",
    "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.

PUT Update Staff

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

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

Headers:

Parameter
Data Type
In
Description

token

string

header

A secure API key used to authenticate and authorize the customer's request.

Body Parameters

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

Parameter
Data Type
Description

retail_stores

list

A list of retail store IDs where the staff member is assigned or registered.

first_name

string

The given name of the staff member being created or updated.

last_name

string

The surname of the staff member being created or updated.

email

string

The staff member's email address, used for communication and login.

is_active

boolean

Indicates whether the staff member's account is currently active.

remote_id

string

A unique external identifier used to sync staff data across systems.

username

string

The system login username for the staff member.

is_staff

boolean

Specifies if the user has staff privileges within the system.

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:

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": "[email protected]",
    "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.

PATCH Update Staff Partially

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

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

Headers:

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

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.

Parameter
Data Type
In
Description

retail_stores

list

body

The list of retail stores where staff is registered

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:

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.

DELETE Deactivate Staff

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

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

Headers:

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

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:

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.

Last updated

Was this helpful?