Create Company Group
The POST endpoint creates a new company group with specified details.
Endpoint
- URL:
/companyGroup/create - Method:
POST
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be application/json. |
accessToken | string | Access token for authentication. (required) |
Request Body
The request body should include the details of the company group to create. Below are the required fields:
| Field | Type | Description |
|---|---|---|
name | string | The name of the company group. |
company | array | List of company IDs to be linked to this group. |
priceList | string | The ID of the associated price list, if applicable. |
status | boolean | Active status of the company group (e.g., true). |
productGroups | object | Specifies how product groups are associated. |
ProductGroups Object:
| Field | Type | Description |
|---|---|---|
type | string | Type of association: either "include" or "exclude". |
productGroups | array | List of product group IDs linked to this association. |
Sample Request Body
{
"name": "company group api",
"company": [
"66430b9b11217fd086e1d1a5"
],
"priceList": "66430b9b11217fd086e1d1a5",
"status": true,
"productGroups": {
"type": "include",
"productGroups": [
"66cda944ee801563b8eec563",
"66430b9b11217fd086e1d1a5"
]
}
}
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"message": "Company group created successfully",
"data": {
// Details of the created company group, e.g., ID, name, etc.
}
}
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the success status of the request, typically true for a successful operation. |
message | string | A message conveying the outcome of the operation, e.g., "Company group created successfully". |
data | object | Contains details of the newly created company group, such as its ID and attributes. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure your request body is formatted according to the specified structure.
- Provide a valid and active access token in the request header to authenticate your request.
- The
productGroupsfield allows you to specify whether to include or exclude specific product groups.