Permission Group Services

This service includes Permission Groups endpoints.

GET Permission Groups List

This method is used to get a list of permission_groups.

Path: /api/v1/permission_groups/

Query Parameters

The following query parameters can be used to get the information about Permissions list.

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Example Request

To get list of permission_groups, a GET request should be sent to /api/v1/permission_groups/ endpoint. No query parameter or request body are required.

import requests

url = "https://{instore_base_url}/api/v1/permission_groups/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d" # Omnitron API Token

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 list of permission_groups information.

This example response serves as a reference to understand the structure and data format of permission groups response.

[
    {
        "id": 1,
        "created_date": "2999-01-01T11:03:56.618122Z",
        "modified_date": "2999-01-01T08:05:31.975929Z",
        "name": "Test Group 2",
        "description": "Test",
        "users": [
            2,
            3,
            4,
            5
        ]
    },
    {
        "id": 2,
        "created_date": "2999-01-01T11:03:56.618122Z",
        "modified_date": "2999-01-01T08:05:31.975929Z",
        "name": "Test Group 2",
        "description": "Test",
        "users": [
            5,
            6,
            7
        ]
    }
]

GET Permission Group Detail

This method is used to get detail of the permission_group.

Path: /api/v1/permission_groups/<id>

Query Parameters

The following query parameters can be used to get the information about permission_group detail.

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Example Request

To get permission_group detail, a GET request should be sent to /api/v1/permission_groups/<id> endpoint. No query parameter or body are required.


import requests

url = "https://{instore_base_url}/api/v1/permission_groups/<id>"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d" # Omnitron API Token

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 permission_group detail information.

Parameter
Data Type
Description

id

integer

The ID of the permission group

name

string

The permission group name

description

string

The description of the permission group

users

integer

Staff id's values of the permission_group

This is an example response of permission_group.

{
      "id": 1,
      "created_date": "2023-08-17T11:03:56.618122Z",
      "modified_date": "2023-08-18T08:05:31.975929Z",
      "name": "General Permission Group",
      "description": "Included All Permissions In One Group By Default",
      "users": [
        2,
        3,
        4,
        5
      ]
}

POST Create Permission Group

This method is used to create the permission_group.

Path: /api/v1/permission_groups/

Query Parameters

The following query parameters can be used to get the information about permission_group.

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Example Request

To create permission_group, a POST request should be sent to /api/v1/permission_groups/ endpoint. No query parameter or body are required.

import requests

url = "https://{instore_base_url}/api/v1/permission_groups/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d" # Omnitron API Token

payload = {
  "name": "Test Permission Group",
  "description": "Included Test Permissions In One Group",
  "permissions": [
    44,43,...
  ]}

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

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

print(response.json())

Example Response (201 Created)

In a successful response with a status code of 201 Created, the API returns created permission_group detail information.

Parameter
Data Type
Description

id

integer

The ID of the permission group

name

string

The permission group name

description

string

The description of the permission group

users

integer

Staff id's values of the permission_group

permissions

integer

Permission id's values of the permission_group

This is an example response.

{
    "name": "Test Permission Group",
    "description": "Included Test Permissions In One Group",
    "permissions": [
        44, 43, ...
    ]
}

PUT Update Permission Group

This method is used to update the permission_group.

Path: /api/v1/permission_groups/<id>/

Query Parameters

The following query parameters can be used to get the information about permission_group.

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Example Request

To update permission_group, a PUT request should be sent to /api/v1/permission_groups/<id>/ endpoint. No query parameter or body are required.

import requests

url = "https://{instore_base_url}/api/v1/permission_groups/<id>/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d" # Omnitron API Token

payload = {
  "name": "Test Permission Group",
  "description": "Included Test Permissions In One Group",
  "permissions": [
    44,43,42,41,...
  ]}

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

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

print(response.json())

Example Response (200 OK)

In a successful response with a status code of 200 OK, the API returns updated permission_group detail information.

Parameter
Data Type
Description

id

integer

The ID of the permission group

name

string

The permission group name

description

string

The description of the permission group

users

integer

Staff id's values of the permission_group

permissions

integer

Permission id's values of the permission_group

This is an example response.

{
    "name": "Test Permission Group",
    "description": "Included Test Permissions In One Group",
    "permissions": [
        44, 43, 42, 41, ...
    ],
    "users": []
}

POST Assign User to Permission Group

This method is used to assign the user to the permission_group.

Path: /api/v1/permission_groups/<id>/assign-users/

Query Parameters

The following query parameters can be used.

Parameter
Data Type
In
Description

token

string

header

The API key of the customer account

Example Request

To assign the user to the permission_group, a POST request should be sent to /api/v1/permission_groups/<id>/assign-users/ endpoint. No query parameter or body are required.

Important Note: (Todo: Need to add the description)

import requests

url = "https://{instore_base_url}/api/v1/permission_groups/<id>/assign-users/"
api_token = "f532eXXXXXXXXXXXXXXXXX201XXXXX9332d" # Omnitron API Token

payload = {
    "users": [1]
}

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

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

print(response.json())

Example Response (200 OK)

In a successful response with a status code of 200 OK, the API returns users and permission_group pk information.

Parameter
Data Type
Description

id

integer

The ID of the permission_group

users

integer

Staff id's values of the permission_group

This is an example response.

{
    "pk": 44,
    "users": [
        1
    ]
}

Was this helpful?