The PUT method of the attributes service adds or replaces attributes on the specified user.
• | In the community edition of the server, or commercial editions without organizations, use the first form of the URL. |
• | In commercial editions with organizations, you must use the second URL to specify the user’s organization. When specifying the organization, use its unique ID, not its path. When logged in as the system admin (superuser), use the first URL to specify users of the root organization. |
There are two syntaxes, the following one is for adding or replacing all attributes
Method | URL | ||
PUT | http://<host>:<port>/jasperserver[-pro]/rest_v2/users/userID/attributes http://<host>:<port>/jasperserver[-pro]/rest_v2/organizations/orgID/users/userID/attributes | ||
Content-Type | Content | ||
application/xml application/json | An attribute descriptor that includes the new list of attributes. All previously defined attributes are replaced by this new list. | ||
Return Value on Success | Typical Return Values on Failure | ||
201 Created – When the attributes were successfully created for the user. 200 OK – When the attributes were successfully updated. | 404 Not Found – When the user ID or organization ID does not match any user or organization. The content includes an error message. 400 Bad Request – When an attribute name or value is null, blank, or too long. If one attribute causes an error, the operation stops and returns an error, but attributes that were already processed remain in their new state. |
The list of attributes defines the name and value of each attribute. Each attribute may only have one value, however, that value may contain a comma separated list that is interpreted by the server as being multi-valued.
The second syntax of the PUT attributes method is for adding or replacing individual attributes.
Method | URL | ||
PUT | http://<host>:<port>/jasperserver[-pro]/rest_v2/users/userID/attributes/attrName http://<host>:<port>/jasperserver[-pro]/rest_v2/organizations/orgID/users/userID/attributes/attrName | ||
Content-Type | Content | ||
application/xml application/json | A single attribute name-value pair. The attribute name must match the attrName exactly as it appears in the URL. If this attribute name already exists on the specified user, this attribute’s value is updated. If the attribute does not exist, it is added to the user’s list of attributes. | ||
Return Value on Success | Typical Return Values on Failure | ||
201 Created – When the attribute was successfully created for the user. 200 OK – When the attribute was successfully updated. | 404 Not Found – When the user ID or organization ID does not match any user or organization. The content includes an error message. |
The content in the request is a single attribute, for example:
PUT http://localhost:8080/jasperserver/rest_v2/users/joeuser/attributes/Attr3
Recommended Comments
There are no comments to display.