Roles Endpoints (2022/06)
These endpoints allow users to manage roles on a network.
Base URL for these endpoints: https://api.bsn.cloud/2022/06/REST/Roles
_________________________________________________________________________
GET /
Returns a list of roles on a network
Required Scope Token
bsn.api.main.roles.retrieve
______________________________________________________________
Query String Parameters
marker
string optional
A value specifying which page to retrieve. This value is useful if the isTruncated
entry in the response body of the previous GET call indicates that the number of role instances exceeds the pageSize
.
This parameter is only required if you need more elements in the paged list than the pageSize
(100).
pageSize
int optional
The maximum number of role instances that can be contained in the response body. This defaults to the maximum allowed page size (100).
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
marker
value is set to the[PagedList].[NextMarker]
property value from the previous BSN.cloud API response.pageSize
is set to1
GET /2022/06/REST/Roles/?marker=4kfak45jfk0915NVe&pageSize=1 HTTP/1.1
Host: api.bsn.cloud
Connection: Keep-Alive
Authorization: Bearer {{UserAccessToken}}
Accept: application/json, application/vnd.bsn.error+json
Accept-Encoding: gzip,deflate
______________________________________________________________
Response
Success Response Body
200: Returns a paged list of Role Entity instances on a network. This will return not more than 100 entities along with the information necessary to return any other remaining pages.
Example
{
"items": [
{
"id": 12345,
"isCustom": true,
"name": "Custom Role 20231115",
"description": "",
"creationDate": "2023-11-15T19:14:10.087Z",
"userCount": 0,
"users": null,
"permissions": [
{
"entityId": null,
"operationUID": "d430853f-c05f-61b4-d137-0237a6984032",
"principal": {
"name": "Custom Role 20231115",
"isCustom": true,
"type": "Role",
"id": 12345
},
"isFixed": false,
"isInherited": false,
"isAllowed": false,
"creationDate": "2023-11-15T19:14:10.097Z"
}
]
}
],
"totalItemCount": 8,
"matchingItemCount": 8,
"pageSize": 1,
"nextMarker": "Cu20afjksdUN78q932",
"isTruncated": true,
"sortExpression": "[Role].[Name] ASC",
"filterExpression": ""
}
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
Endpoints:
- 1 GET /
- 2 POST /
- 3 GET /{id:int}/
- 4 PUT /{id:int}/
- 5 DELETE /{id:int}/
- 6 GET /{name}/
- 7 PUT /{name}/
- 8 DELETE /{name}/
- 9 GET /Operations/
- 10 GET /{id:int}/Permissions/
- 11 POST /{id:int}/Permissions/
- 12 DELETE /{id:int}/Permissions/
- 13 GET /{name}/Permissions/
- 14 POST /{name}/Permissions/
- 15 DELETE /{name}/Permissions/
POST /
Creates a role on a network
Required Scope Token
bsn.api.main.roles.create
______________________________________________________________
Request Body
The Role Entity
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
POST /2022/06/REST/Roles/ HTTP/1.1
Host: api.bsn.cloud
Connection: Keep-Alive
Authorization: Bearer {{UserAccessToken}}
Accept: application/json, application/vnd.bsn.error+json
Accept-Encoding: gzip,deflate
Content-Type: application/json
Content-Length: 962
This is the example request body:
______________________________________________________________
Response
Success Response Body
201: Returns the Role Entity created and referenced by the Uri (given by the Location header field) in the response.
Example
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
415: The server cannot accept the data representation that you sent (as specified in the "Content-Type" header)
5XX: Any 500 code is an internal server error
GET /{id:int}/
Returns a specified role on a network
Required Scope Token
bsn.api.main.roles.retrieve
______________________________________________________________
Segment
id
int
A unique identifier for a role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
______________________________________________________________
Response
Success Response with Body
200: Returns the Role Entity
Example
This is an example of a 200 level response:
Success Response
304: The resource was not modified since the time specified in the “If-Modified-Since” header
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
PUT /{id:int}/
Updates the specified role on a network
Required Scope Token
bsn.api.main.roles.update
______________________________________________________________
Segment
id
int
A unique identifier for a role
______________________________________________________________
Request Body
The Role Entity
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
This is the example request body:
______________________________________________________________
Response
Success
204: The role was successfully updated.
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
412: Precondition failed (the resource changed since the time specified in the “If-Unmodified-Since” header value)
415: The server cannot accept the data representation that you sent (as specified in the "Content-Type" header)
5XX: Any 500 code is an internal server error
DELETE /{id:int}/
Removes the specified custom role on a network
Required Scope Token
bsn.api.main.roles.delete
______________________________________________________________
Segment
id
int
A unique identifier for a custom role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
______________________________________________________________
Response
Success
204: The specified role has been removed
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules (for example, if the user attempts to delete a system role).
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
412: Precondition failed (the resource changed since the time specified in the “If-Unmodified-Since” header value)
5XX: Any 500 code is an internal server error
GET /{name}/
Returns the specified role on a network
Required Scope Token
bsn.api.main.roles.retrieve
______________________________________________________________
Segment
name
string
The name of the role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCustom Role 20231115
______________________________________________________________
Response
Success Response with Body
200: Returns the Role Entity
Example
This is an example of a 200 level response:
Success Response
304: The resource was not modified since the time specified in the “If-Modified-Since” header
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
PUT /{name}/
Updates the specified role on a network
Required Scope Token
bsn.api.main.roles.update
______________________________________________________________
Segment
name
string
The name of the role
______________________________________________________________
Request Body
The Role Entity
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCustom Role 20231115
This is the example request body:
______________________________________________________________
Response
Success
204: The role was successfully updated.
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
412: Precondition failed (the resource changed since the time specified in the “If-Unmodified-Since” header value)
415: The server cannot accept the data representation that you sent (as specified in the "Content-Type" header)
5XX: Any 500 code is an internal server error
DELETE /{name}/
Removes the specified custom role on a network
Required Scope Token
bsn.api.main.roles.delete
______________________________________________________________
Segment
name
string
The name of the custom role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCustom Role 20231116
______________________________________________________________
Response
Success
204: The specified role has been removed
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid, or it is rejected in accordance with the business rules (for example, if the user attempts to delete a system role).
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
412: Precondition failed (the resource changed since the time specified in the “If-Unmodified-Since” header value)
5XX: Any 500 code is an internal server error
GET /Operations/
Returns operational permissions granted to roles for specific business operations
Required Scope Token
bsn.api.main.operations.retrieve
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
______________________________________________________________
Response
Success Response Body
200: Returns the Business Operations Entity
Example
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
GET /{id:int}/Permissions/
Includes object permissions granted to a given role
Required Scope Token
bsn.api.main.roles.retrieve
______________________________________________________________
Segment
id
int
A unique identifier for a role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
______________________________________________________________
Response
Success Response Body
200: Returns an array of Permission entities granted to a given role
Example
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
POST /{id:int}/Permissions/
Add permissions for specified roles on a network
Required Scope Token
bsn.api.main.roles.update
______________________________________________________________
Segment
id
int
A unique identifier for a role
______________________________________________________________
Request Body
An array of Permission entities
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
This is the example request body:
______________________________________________________________
Response
Success
204: The permissions were successfully added to the specified role
Failure
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
415: The server cannot accept the data representation that you sent (as specified in the "Content-Type" header)
5XX: Any 500 code is an internal server error
DELETE /{id:int}/Permissions/
Removes permissions for specified roles on a network
Required Scope Token
bsn.api.main.roles.delete
______________________________________________________________
Segment
id
int
A unique identifier for a role
______________________________________________________________
Request Body
An array of Permission entities
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
id
is set to12345
This is the example request body:
______________________________________________________________
Response
Success
204: The specified permissions have been removed from the role
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
GET /{name}/Permissions/
Includes object permissions granted to a given role.
Required Scope Token
bsn.api.main.roles.retrieve
______________________________________________________________
Segment
name
string
The name of the role
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCreators
______________________________________________________________
Response
Success Response Body
200: Returns an array of Permission entities granted to a given role
Example
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request is malformed and therefore invalid
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error
POST /{name}/Permissions/
Add permissions for specified roles on a network
Required Scope Token
bsn.api.main.roles.update
______________________________________________________________
Segment
name
string
The name of the role
______________________________________________________________
Request Body
An array of Permission entities
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCreators
This is the example request body:
______________________________________________________________
Response
Success
204: The permissions were successfully added to the specified role
Failure
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
415: The server cannot accept the data representation that you sent (as specified in the "Content-Type" header)
5XX: Any 500 code is an internal server error
DELETE /{name}/Permissions/
Removes permissions for specified role on a network
Required Scope Token
bsn.api.main.roles.delete
______________________________________________________________
Segment
name
string
The name of the role
______________________________________________________________
Request Body
An array of Permission entities
______________________________________________________________
Request Example
The example request parameters and headers are set as follows:
name
is set toCreators
This is the example request body:
______________________________________________________________
Response
Success
204: The specified permissions have been removed from the role
Failure
300: The requested representation could not be returned because it is ambiguous (there are multiple requested representations)
400: The request or request body is malformed and therefore invalid, or it is rejected in accordance with the business rules
401: The access token is invalid or not specified
403: The supplied access token, though valid, doesn't provide access to this method
404: The server cannot find the requested resource (the path does not exist)
406: The server cannot return the data representation that you requested (as specified in the "Accept" header)
5XX: Any 500 code is an internal server error