How to create a category in dashboards listing page via REST API ?
In order to create a new category via REST API, users must have create access for categories. This article outlines the process for adding a new category, including the required authorizations, request body schema, and possible responses.
Authorization
To execute this action, please ensure that a access token is included in your request header. For details on obtaining the access token, please refer to the relevant documentation here.
Authorization: bearer <token>
Self-Hosted Server
For self-hosted instances, use the following endpoint:
https://{yourdomain}/bi/api/site/<site_identifier>/v4.0/categories
Bold BI Cloud Server
For Bold BI Cloud instances, the endpoint is:
https://{yourdomain}/bi/api/v4.0/categories
Request Type
- POST: This request type is used to create a new category in dashboards page.
Example Request
Here is an example of how to structure your POST request:
Request Body Schema
When making a request to create a new category, the following details must be included in the request body:
- Name (required): The name of the category. This should be a string value.
- Description: A brief description of the category. This should be a string value.
Example Request Body
{
"name": "New Category",
"description": "This is a description of the new category."
}
Responses
The API will return different responses based on the outcome of the request:
- 200: The category was created successfully.
- 400: The content of the request body is missing or incomplete.
- 401: Access denied. Ensure that the authorization token is valid and has the necessary permissions.
- 405: Request type was not POST. Ensure that the request method is set to POST.
- 406: The content of the request body is invalid. Check the format and required fields.
- 409: Item name already exists. Choose a different name for the category.
- 417: Failed to add category. This may indicate a server error or other issue.
After refreshing the page in application, a new category will be created as shown below:
Additional References
To know more about Bold BI APIs