curl -X POST "https://api-sandbox.whitelabel.com/v1/organizations/roles" \
-H "Content-Type: application/json" \
-H "PUBLIC-API-KEY: <PUBLIC-API-KEY>" \
-H "PRIVATE-SECRET-KEY: <PRIVATE-SECRET-KEY>" \
-d '{
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}' const response = await fetch ( `https://api-sandbox.whitelabel.com/v1/organizations/roles` , {
method: 'POST' ,
headers: { 'Content-Type' : 'application/json' , 'PUBLIC-API-KEY' : '<PUBLIC-API-KEY>' , 'PRIVATE-SECRET-KEY' : '<PRIVATE-SECRET-KEY>' },
body: JSON . stringify ({
"name" : "Operator" ,
"description" : "Custom operator" ,
"permission_ids" : [],
"testing_permission_ids" : [],
"role_type" : "account"
})
});
const data = await response. json (); import requests
response = requests.request(
"POST" ,
"https://api-sandbox.whitelabel.com/v1/organizations/roles" ,
headers = { "PUBLIC-API-KEY" : "<PUBLIC-API-KEY>" , "PRIVATE-SECRET-KEY" : "<PRIVATE-SECRET-KEY>" },
json = {
"name" : "Operator" ,
"description" : "Custom operator" ,
"permission_ids" : [],
"testing_permission_ids" : [],
"role_type" : "account"
},
)
data = response.json() <? php
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL , "https://api-sandbox.whitelabel.com/v1/organizations/roles" );
curl_setopt ($ch, CURLOPT_RETURNTRANSFER , true );
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST , "POST" );
curl_setopt ($ch, CURLOPT_HTTPHEADER , [ "Content-Type: application/json" , "PUBLIC-API-KEY: <PUBLIC-API-KEY>" , "PRIVATE-SECRET-KEY: <PRIVATE-SECRET-KEY>" ]);
curl_setopt ($ch, CURLOPT_POSTFIELDS , '{
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}' );
$response = curl_exec ($ch);
curl_close ($ch); package main
import (
" fmt "
" io "
" net/http "
" strings "
)
func main () {
req, _ := http. NewRequest ( "POST" , "https://api-sandbox.whitelabel.com/v1/organizations/roles" , strings. NewReader ( `{
"name": "Operator",
"description": "Custom operator",
"permission_ids": [],
"testing_permission_ids": [],
"role_type": "account"
}` ))
req.Header. Set ( "Content-Type" , "application/json" )
req.Header. Set ( "PUBLIC-API-KEY" , "<PUBLIC-API-KEY>" )
req.Header. Set ( "PRIVATE-SECRET-KEY" , "<PRIVATE-SECRET-KEY>" )
resp, err := http.DefaultClient. Do (req)
if err != nil {
panic (err)
}
defer resp.Body. Close ()
data, _ := io. ReadAll (resp.Body)
fmt. Println ( string (data))
} HttpClient client = HttpClient. newHttpClient ();
HttpRequest request = HttpRequest. newBuilder ()
. uri (URI. create ( "https://api-sandbox.whitelabel.com/v1/organizations/roles" ))
. header ( "Content-Type" , "application/json" )
. header ( "PUBLIC-API-KEY" , "<PUBLIC-API-KEY>" )
. header ( "PRIVATE-SECRET-KEY" , "<PRIVATE-SECRET-KEY>" )
. method ( "POST" , HttpRequest.BodyPublishers. ofString ( "{ \n \" name \" : \" Operator \" , \n \" description \" : \" Custom operator \" , \n \" permission_ids \" : [], \n \" testing_permission_ids \" : [], \n \" role_type \" : \" account \"\n }" ))
. build ();
HttpResponse < String > response = client. send (request, HttpResponse.BodyHandlers. ofString ());
System.out. println (response. body ()); require "net/http"
require "uri"
uri = URI ( "https://api-sandbox.whitelabel.com/v1/organizations/roles" )
http = Net :: HTTP . new (uri. host , uri. port )
http. use_ssl = uri. scheme == "https"
request = Net :: HTTP :: Post . new (uri)
request[ "Content-Type" ] = "application/json"
request[ "PUBLIC-API-KEY" ] = "<PUBLIC-API-KEY>"
request[ "PRIVATE-SECRET-KEY" ] = "<PRIVATE-SECRET-KEY>"
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. body ⧉