Check multiple permissions for a user
1 min
POST
https://api.upstartcommerce.com/profile-permissions/users/{userId}/permissions/check-batch
Path Parameters
- userIdstring<uuid>requiredDescriptionFormatuuid
Body Parameters
- bodyBatchPermissionCheckRequestrequiredDescription
- permissionsstring[]requiredExample
[ "order.read", "order.write", "order.delete" ]
Description
Responses
200
- BatchPermissionCheckResponseDescription
- resultsmap<string, boolean>requiredExample
{ "order.read": true, "order.write": true, "order.delete": false }Description
400
- ErrorResponseDescription
- errorstring<bad_request | unauthorized | forbidden | not_found | conflict | internal_error>requiredExampleDescriptionAllowedbad_requestunauthorizedforbiddennot_foundconflictinternal_error
- messagestringrequiredExampleDescription
- detailsmap<string, string>Description
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 POST \
--url https://api.upstartcommerce.com/profile-permissions/users/{userId}/permissions/check-batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"permissions": []
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"permissions": []
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/profile-permissions/users/{userId}/permissions/check-batch", 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}/permissions/check-batch")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"permissions": []
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/profile-permissions/users/{userId}/permissions/check-batch"
payload = json.dumps({
"permissions": []
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Batch permission check completed
{
"results": "{\"order.read\":true,\"order.write\":true,\"order.delete\":false}"
}400
// Invalid request parameters
{
"error": "not_found",
"message": "Role not found",
"details": ""
}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": ""
}