Get all roles assigned to a user
1 min
GET
https://api.upstartcommerce.com/profile-permissions/users/{userId}/roles
Path Parameters
- userIdstring<uuid>requiredDescriptionFormatuuid
Query Parameters
- includeExpiredbooleanDescriptionDefaultfalse
Responses
200
- UserRolesResponseDescription
- userIdstring<uuid>requiredFormatuuid
- rolesUserRoleAssignment[]requiredDescription
- roleIdstringrequiredDescription
- roleNamestringrequiredExampleDescription
- assignedAtstring<date-time>requiredDescriptionFormatdate-time
- assignedBystringDescription
- expiresAtstring<date-time>DescriptionFormatdate-time
401
- ErrorResponseDescription
- errorstring<bad_request | unauthorized | forbidden | not_found | conflict | internal_error>requiredExampleDescriptionAllowedbad_requestunauthorizedforbiddennot_foundconflictinternal_error
- messagestringrequiredExampleDescription
- detailsmap<string, string>Description
404
- ErrorResponseDescription
- errorstring<bad_request | unauthorized | forbidden | not_found | conflict | internal_error>requiredExampleDescriptionAllowedbad_requestunauthorizedforbiddennot_foundconflictinternal_error
- messagestringrequiredExampleDescription
- detailsmap<string, string>Description
500
- ErrorResponseDescription
- errorstring<bad_request | unauthorized | forbidden | not_found | conflict | internal_error>requiredExampleDescriptionAllowedbad_requestunauthorizedforbiddennot_foundconflictinternal_error
- messagestringrequiredExampleDescription
- detailsmap<string, string>Description
curl
curl --request GET \
--url 'https://api.upstartcommerce.com/profile-permissions/users/{userId}/roles?includeExpired=boolean' \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/profile-permissions/users/{userId}/roles?includeExpired=boolean", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/profile-permissions/users/{userId}/roles?includeExpired=boolean")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/profile-permissions/users/{userId}/roles?includeExpired=boolean"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// List of user roles
{
"userId": "",
"roles": [
{
"roleId": "",
"roleName": "operator",
"assignedAt": "",
"assignedBy": "",
"expiresAt": ""
}
]
}401
// Missing or invalid authentication token
{
"error": "not_found",
"message": "Role not found",
"details": ""
}404
// User not found
{
"error": "not_found",
"message": "Role not found",
"details": ""
}500
// Internal server error
{
"error": "not_found",
"message": "Role not found",
"details": ""
}