SAP Cloud Platform Open Connectors

Roles

See the roles in your organization and add or revoke roles.

Retrieve a User's Roles and Privileges

GET /users/{id}/roles

Retrieve a specific user's roles and privileges by user ID. 

Path Parameters

Id
The id associated with a specific user.

Response Parameters

idThe unique identifier of the role.
nameThe name of the role.
keyThe unique key associated with the role: default-user, admin, or org-admin.
active
descriptionA description of the role.
features
An object containing the features associated with the role.
privileges
A object containing the privileges associated with the role.
hide

Example Request

curl -X GET \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/users/12435/roles \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Example Response

[  
  {  
    "id":16339,
    "name":"Default User",
    "key":"default-user",
    "active":true,
    "description":"Default User",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  },
  {  
    "id":15,
    "name":"Account",
    "key":"admin",
    "active":true,
    "description":"Account Administrator",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  }
]


Revoke a Role from a User

DELETE /users/{userId}/roles/{roleKey}

Revoke a role assigned to a user. 

Path Parameters

Id
The id associated with a specific user.
roleKeyThe unique key associated with the role to revoke: default-user, admin, or org-admin.

Example Request

curl -X DELETE \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/users/12435/roles/admin \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Example Response

The response is empty. You can confirm that you revoked the role with GET /users/{id}/roles

Assign a Role to a User

PUT /users/{userId}/roles/{roleKey}

Assign a role to a user. 

Path Parameters

userId
The id associated with a specific user.
roleKeyThe unique key associated with the role: default-user, admin, or org-admin.

Example Request

curl -X PUT \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/users/12435/roles/admin \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -H 'Content-Type:application/json' \

Example Response

[  
  {  
    "id":16339,
    "name":"Default User",
    "key":"default-user",
    "active":true,
    "description":"Default User",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  },
  {  
    "id":15,
    "name":"Account",
    "key":"admin",
    "active":true,
    "description":"Account Administrator",
    "features":[  

    ],
    "privileges":[  

    ],
    "hide":false
  }
]