Articles in this section
Category / Section

How to add an user attribute for a specific user via REST API ?

Published:

This article provides guidance on how to add an attribute for a specific user through an API request.

Authorization

To execute this action, please ensure that an 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>/v5.0/attribute/user

Bold BI Cloud Server

For Bold BI Cloud instances, the endpoint is:

https://{yourdomain}/bi/api/v5.0/attribute/user

Request Type

  • POST: This request type is used to add a user attribute for the current user through an API request.

Example Request

Here is an example of how to structure your PUT request:

image.png

Request Body Schema

The request body must contain an Attribute object with the following fields:

  • Name (required): A string representing the name of the attribute.
  • Value (required): A string representing the value of the attribute.
  • Description (optional): A string providing a description of the attribute.
  • CanEncrypt (optional): A boolean indicating whether the attribute value should be encrypted.
  • UserId (required): An integer representing the ID of the user to whom the attribute will be added.

Example Request Body

{
  "Name": "exampleAttribute",
  "Value": "exampleValue",
  "Description": "This is an example attribute.",
  "CanEncrypt": true,
  "UserId": 0
}

Responses

The API will return different responses based on the outcome of the request:

  • 200: User custom attribute has been added successfully.

image.png

  • 400: The content of the request body is missing or incomplete.
  • 405: Request type was not POST.
  • 406: The content of the request body is invalid.
  • 409: Attribute name already exists.
  • 417: Failed to add attribute details.

After refreshing the page in Bold BI, Custom Attribute was created for that specified user as below :

image.png

Conclusion

Adding user attributes is a straightforward process as long as the request body is correctly formatted and all required fields are provided. Ensure that the attribute name and user Id is unique to avoid conflicts.

Additional References

To know more about Bold BI APIs

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
RU
Written by Raghul Umashangar
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied