Skip to main content
GET
/
custom_role
List Custom Roles
curl --request GET \
  --url https://api.partoo.co/v2/custom_role \
  --header 'x-APIKey: <api-key>'
import requests

url = "https://api.partoo.co/v2/custom_role"

headers = {"x-APIKey": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-APIKey': '<api-key>'}};

fetch('https://api.partoo.co/v2/custom_role', 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.partoo.co/v2/custom_role",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-APIKey: <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"
"net/http"
"io"
)

func main() {

url := "https://api.partoo.co/v2/custom_role"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-APIKey", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.partoo.co/v2/custom_role")
.header("x-APIKey", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.partoo.co/v2/custom_role")

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

request = Net::HTTP::Get.new(url)
request["x-APIKey"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "page": 1,
  "max_page": 10,
  "count": 3,
  "custom_roles": [
    {
      "name": "This is My Custom Role",
      "api_id": "this_is_my_custom_role",
      "description": "It has a custom permission configuration!",
      "org_id": 42,
      "is_builtin": false
    }
  ]
}
{
"errors": {
"authentication": "User not authenticated"
}
}
{
"errors": {
"authorization": "Operation not allowed"
}
}

Authorizations

x-APIKey
string
header
required

The authentication system on Partoo API is using API Key that should be put in the header of the request (the name of the header is x-APIKey). An api_key is linked to a user. This user's role will give you different access level to the API features.

Query Parameters

page
integer
default:1

Page number. Starts at 1. Any value lower than 1 will be considered as 1. For the number of items per page, see the per_page query parameter.

per_page
integer
default:30

Number of items to return per page. Currently limited to 100.

Required range: 1 <= x <= 100
org_id
integer

Organization ID. Only PROVIDER users can specify a different organization. If not provided, defaults to your own organization.

only_available_roles
boolean
default:false

If true: only return roles for which the requesting user has all required permissions (Custom Fields permissions are also taken into account).

Response

OK

A list of Custom Roles is returned upon success.

page
integer

Current page number

Example:

1

max_page
integer

Last page number

Example:

10

count
integer

Total number of Custom Roles found.

Example:

3

custom_roles
object[]

The list of Custom Roles.