> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/oms/permission-group-services.md).

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

```python
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.

```json
[
    {
        "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.

```python

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.

```json
{
      "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.

```python
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.

```json
{
    "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.

```python
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.

```json
{
    "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)

```python
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.

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/oms/permission-group-services.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
