Roles
Create Role
Create a custom role for the organization.
POST
/
organizations
/
roles
Create Role
curl --request POST \
--url https://api-sandbox.y.uno/v1/organizations/roles \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--data '
{
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}
'import requests
url = "https://api-sandbox.y.uno/v1/organizations/roles"
payload = {
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}
headers = {
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Operator',
description: 'Custom operator',
permission_ids: [],
testing_permission_ids: [],
role_type: 'account'
})
};
fetch('https://api-sandbox.y.uno/v1/organizations/roles', 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-sandbox.y.uno/v1/organizations/roles",
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' => 'Operator',
'description' => 'Custom operator',
'permission_ids' => [
],
'testing_permission_ids' => [
],
'role_type' => 'account'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <api-key>"
],
]);
$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-sandbox.y.uno/v1/organizations/roles"
payload := strings.NewReader("{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<api-key>")
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-sandbox.y.uno/v1/organizations/roles")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/organizations/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"admin": true,
"permission_ids": [
"<string>"
],
"testing_permission_ids": [
"<string>"
],
"role_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Create a custom role for the organization.
Authorizations
Body
application/json
Was this page helpful?
⌘I
Create Role
curl --request POST \
--url https://api-sandbox.y.uno/v1/organizations/roles \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--data '
{
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}
'import requests
url = "https://api-sandbox.y.uno/v1/organizations/roles"
payload = {
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}
headers = {
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Operator',
description: 'Custom operator',
permission_ids: [],
testing_permission_ids: [],
role_type: 'account'
})
};
fetch('https://api-sandbox.y.uno/v1/organizations/roles', 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-sandbox.y.uno/v1/organizations/roles",
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' => 'Operator',
'description' => 'Custom operator',
'permission_ids' => [
],
'testing_permission_ids' => [
],
'role_type' => 'account'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <api-key>"
],
]);
$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-sandbox.y.uno/v1/organizations/roles"
payload := strings.NewReader("{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<api-key>")
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-sandbox.y.uno/v1/organizations/roles")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/organizations/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Operator\",\n \"description\": \"Custom operator\",\n \"permission_ids\": [],\n \"testing_permission_ids\": [],\n \"role_type\": \"account\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"admin": true,
"permission_ids": [
"<string>"
],
"testing_permission_ids": [
"<string>"
],
"role_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}