Skip to main content

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

HeaderTypeDescription
Content-TypestringMust be application/json.
accessTokenstringAccess token for authentication. (required)

Request Body

The request body should include the details of the company group to create. Below are the required fields:

FieldTypeDescription
namestringThe name of the company group.
companyarrayList of company IDs to be linked to this group.
priceListstringThe ID of the associated price list, if applicable.
statusbooleanActive status of the company group (e.g., true).
productGroupsobjectSpecifies how product groups are associated.

ProductGroups Object:

FieldTypeDescription
typestringType of association: either "include" or "exclude".
productGroupsarrayList 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

FieldTypeDescription
successbooleanIndicates the success status of the request, typically true for a successful operation.
messagestringA message conveying the outcome of the operation, e.g., "Company group created successfully".
dataobjectContains details of the newly created company group, such as its ID and attributes.

Error Responses

Status CodeDescription
400Bad Request: Invalid input data.
401Unauthorized: Access token is invalid or missing.
500Internal 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 productGroups field allows you to specify whether to include or exclude specific product groups.