curl --request POST \
--url https://services.pref.rio/heimdall-admin/api/v1/actions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Read user information",
"name": "user:read"
}
'import requests
url = "https://services.pref.rio/heimdall-admin/api/v1/actions/"
payload = {
"description": "Read user information",
"name": "user:read"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Read user information', name: 'user:read'})
};
fetch('https://services.pref.rio/heimdall-admin/api/v1/actions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://services.pref.rio/heimdall-admin/api/v1/actions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Read user information',
'name' => 'user:read'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://services.pref.rio/heimdall-admin/api/v1/actions/"
payload := strings.NewReader("{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://services.pref.rio/heimdall-admin/api/v1/actions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/heimdall-admin/api/v1/actions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "user:read",
"description": "Read user information",
"endpoint_count": 0
}{
"detail": "Action with name 'user:read' already exists"
}{
"detail": "Could not validate credentials"
}{
"detail": "Insufficient permissions to create actions"
}{
"detail": "Validation error",
"errors": [
{
"loc": [
"body",
"name"
],
"msg": "string does not match regex",
"type": "value_error.regex"
}
]
}{
"detail": "Failed to create action: Database connection error"
}Create a new action
Create a new action that can be used in authorization policies and endpoint mappings.
Actions: Define granular permissions available in the system. Examples include
user:read, group:create, data:export, etc.
Authorization: Requires admin privileges to create actions.
Naming Convention: Use colon-separated format like resource:operation
(e.g., user:read, group:create, data:export).
Use Cases:
- Define new permissions for application features
- Create fine-grained access controls
- Integrate with external authorization systems
- Map API endpoints to specific actions
Endpoint Mapping: Actions can be mapped to API endpoints using the mappings API.
curl --request POST \
--url https://services.pref.rio/heimdall-admin/api/v1/actions/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Read user information",
"name": "user:read"
}
'import requests
url = "https://services.pref.rio/heimdall-admin/api/v1/actions/"
payload = {
"description": "Read user information",
"name": "user:read"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: 'Read user information', name: 'user:read'})
};
fetch('https://services.pref.rio/heimdall-admin/api/v1/actions/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://services.pref.rio/heimdall-admin/api/v1/actions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Read user information',
'name' => 'user:read'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://services.pref.rio/heimdall-admin/api/v1/actions/"
payload := strings.NewReader("{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://services.pref.rio/heimdall-admin/api/v1/actions/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/heimdall-admin/api/v1/actions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Read user information\",\n \"name\": \"user:read\"\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "user:read",
"description": "Read user information",
"endpoint_count": 0
}{
"detail": "Action with name 'user:read' already exists"
}{
"detail": "Could not validate credentials"
}{
"detail": "Insufficient permissions to create actions"
}{
"detail": "Validation error",
"errors": [
{
"loc": [
"body",
"name"
],
"msg": "string does not match regex",
"type": "value_error.regex"
}
]
}{
"detail": "Failed to create action: Database connection error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request model for creating a new action.
Unique name for the action (lowercase letters, numbers, underscores, and colons only)
1 - 100^[a-z0-9_:]+$"user:read"
Human-readable description of the action's purpose
1 - 500"Read user information"
Response
Action created successfully
Response model for action information.
