Skip to main content
POST
/
v3
/
roles
/
definitions
Add Role Definition
curl --request POST \
  --url https://api.{tenant}.getomneo.com/api/v3/roles/definitions \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "handle": "<string>",
  "description": "<string>",
  "short_description": "<string>",
  "icon": "<string>",
  "image_url": "<string>",
  "period": 123,
  "absolute_expiry": "<string>",
  "notes": "<string>",
  "group_name": "<string>",
  "group_handle": "<string>",
  "meta": [
    "<string>"
  ],
  "custom_fields": [
    {
      "namespace": "<string>",
      "handle": "<string>",
      "value": "<string>"
    }
  ]
}
'
import requests

url = "https://api.{tenant}.getomneo.com/api/v3/roles/definitions"

payload = {
"name": "<string>",
"handle": "<string>",
"description": "<string>",
"short_description": "<string>",
"icon": "<string>",
"image_url": "<string>",
"period": 123,
"absolute_expiry": "<string>",
"notes": "<string>",
"group_name": "<string>",
"group_handle": "<string>",
"meta": ["<string>"],
"custom_fields": [
{
"namespace": "<string>",
"handle": "<string>",
"value": "<string>"
}
]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
handle: '<string>',
description: '<string>',
short_description: '<string>',
icon: '<string>',
image_url: '<string>',
period: 123,
absolute_expiry: '<string>',
notes: '<string>',
group_name: '<string>',
group_handle: '<string>',
meta: ['<string>'],
custom_fields: [{namespace: '<string>', handle: '<string>', value: '<string>'}]
})
};

fetch('https://api.{tenant}.getomneo.com/api/v3/roles/definitions', 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://api.{tenant}.getomneo.com/api/v3/roles/definitions",
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([
'name' => '<string>',
'handle' => '<string>',
'description' => '<string>',
'short_description' => '<string>',
'icon' => '<string>',
'image_url' => '<string>',
'period' => 123,
'absolute_expiry' => '<string>',
'notes' => '<string>',
'group_name' => '<string>',
'group_handle' => '<string>',
'meta' => [
'<string>'
],
'custom_fields' => [
[
'namespace' => '<string>',
'handle' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"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://api.{tenant}.getomneo.com/api/v3/roles/definitions"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"handle\": \"<string>\",\n \"description\": \"<string>\",\n \"short_description\": \"<string>\",\n \"icon\": \"<string>\",\n \"image_url\": \"<string>\",\n \"period\": 123,\n \"absolute_expiry\": \"<string>\",\n \"notes\": \"<string>\",\n \"group_name\": \"<string>\",\n \"group_handle\": \"<string>\",\n \"meta\": [\n \"<string>\"\n ],\n \"custom_fields\": [\n {\n \"namespace\": \"<string>\",\n \"handle\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

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://api.{tenant}.getomneo.com/api/v3/roles/definitions")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"handle\": \"<string>\",\n \"description\": \"<string>\",\n \"short_description\": \"<string>\",\n \"icon\": \"<string>\",\n \"image_url\": \"<string>\",\n \"period\": 123,\n \"absolute_expiry\": \"<string>\",\n \"notes\": \"<string>\",\n \"group_name\": \"<string>\",\n \"group_handle\": \"<string>\",\n \"meta\": [\n \"<string>\"\n ],\n \"custom_fields\": [\n {\n \"namespace\": \"<string>\",\n \"handle\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.{tenant}.getomneo.com/api/v3/roles/definitions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"handle\": \"<string>\",\n \"description\": \"<string>\",\n \"short_description\": \"<string>\",\n \"icon\": \"<string>\",\n \"image_url\": \"<string>\",\n \"period\": 123,\n \"absolute_expiry\": \"<string>\",\n \"notes\": \"<string>\",\n \"group_name\": \"<string>\",\n \"group_handle\": \"<string>\",\n \"meta\": [\n \"<string>\"\n ],\n \"custom_fields\": [\n {\n \"namespace\": \"<string>\",\n \"handle\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": 123,
    "name": "<string>",
    "handle": "<string>",
    "description": "<string>",
    "short_description": "<string>",
    "icon": "<string>",
    "image_url": "<string>",
    "timezone": "<string>",
    "period": 123,
    "period_type": "<string>",
    "absolute_expiry": "<string>",
    "group_name": "<string>",
    "group_handle": "<string>",
    "notes": "<string>",
    "meta": [
      "<unknown>"
    ],
    "custom_fields": {},
    "created_at": "<string>",
    "updated_at": "<string>"
  }
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>",
"errors": {}
}

Body

application/json
name
string
required
handle
string
required
description
string | null
short_description
string | null
icon
string<uri> | null
image_url
string<uri> | null
period
integer | null
period_type
enum<string> | null
Available options:
days,
weeks,
months,
years,
absolute_date,
absolute_week,
absolute_month
absolute_expiry
string | null
notes
string | null
group_name
string | null
group_handle
string | null
meta
string[] | null
custom_fields
object[]

Response

RoleDefinition

data
RoleDefinition · object
required