Permission
Operations related to permissions
Get user permissions
GET
/users/{userName}/permissionsRetrieves all permissions for a specific user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Code Examples
curl -X GET "/api/v1/users/{userName}/permissions" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users/{userName}/permissions', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users/{userName}/permissions', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get('/api/v1/users/{userName}/permissions', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "/api/v1/users/{userName}/permissions", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
[
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
]{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Add permission to user
POST
/users/{userName}/permissionsAdds a new permission to a specific user.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Request Body
Example:
{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}Code Examples
curl -X POST "/api/v1/users/{userName}/permissions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}'const response = await fetch('/api/v1/users/{userName}/permissions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"resource": "orders_table",
"resource_type": "table",
"type": "read"
})
});
const data = await response.json();fetch('/api/v1/users/{userName}/permissions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"resource": "orders_table",
"resource_type": "table",
"type": "read"
})
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.post(
'/api/v1/users/{userName}/permissions',
headers=headers,
json={
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
body := []byte(`{
"resource": "orders_table",
"resource_type": "table",
"type": "read"
}`)
req, _ := http.NewRequest("POST", "/api/v1/users/{userName}/permissions", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
{
"message": "Operation completed successfully"
}{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}Remove permission from user
DELETE
/users/{userName}/permissionsRemoves a specific permission rule from a user based on resource name and type.
Security
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer YOUR_API_KEY
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
resource | string | query | Yes | The name of the resource for the permission to be removed. |
resourceType | string (table, user, *) | query | Yes | The type of the resource for the permission to be removed. |
Code Examples
curl -X DELETE "/api/v1/users/{userName}/permissions?resource=orders_table&resourceType=value" \
-H "Authorization: Bearer YOUR_API_KEY"const response = await fetch('/api/v1/users/{userName}/permissions?resource=orders_table&resourceType=value', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();fetch('/api/v1/users/{userName}/permissions?resource=orders_table&resourceType=value', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.delete('/api/v1/users/{userName}/permissions?resource=orders_table&resourceType=value', headers=headers)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "/api/v1/users/{userName}/permissions?resource=orders_table&resourceType=value", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
}Responses
No response body
{
"error": "An error message"
}{
"error": "An error message"
}{
"error": "An error message"
}