List role bindings - Arize AX Docs

List role bindings

cURL

curl --request GET \
  --url 'https://api.arize.com/v2/role-bindings?limit=50' \
  --header 'Authorization: Bearer <token>'

Python

import requests

url = "https://api.arize.com/v2/role-bindings?limit=50"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)

JavaScript (Fetch)

const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.arize.com/v2/role-bindings?limit=50', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.arize.com/v2/role-bindings?limit=50",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "GET",\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://api.arize.com/v2/role-bindings?limit=50"

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

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}

Unirest (Java)

HttpResponse<String> response = Unirest.get("https://api.arize.com/v2/role-bindings?limit=50")
  .header("Authorization", "Bearer <token>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.arize.com/v2/role-bindings?limit=50")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body

Possible Responses

Example Response (200)

{
  "role_bindings": [
    {
      "id": "Um9sZUJpbmRpbmc6MTphQmNE",
      "role_id": "Um9sZToxOmFCY0Q=",
      "user_id": "VXNlcjo0MjphQmNE",
      "resource_type": "SPACE",
      "resource_id": "U3BhY2U6MTpWNEth",
      "created_at": "2024-06-01T10:00:00Z",
      "updated_at": "2024-06-01T10:00:00Z"
    },
    {
      "id": "Um9sZUJpbmRpbmc6MjphQmNE",
      "role_id": "Um9sZToyOmFCY0Q=",
      "user_id": "VXNlcjoxMDphQmNE",
      "resource_type": "PROJECT",
      "resource_id": "UHJvamVjdDo1OmFCY0Q=",
      "created_at": "2024-06-02T10:00:00Z",
      "updated_at": "2024-06-02T10:00:00Z"
    }
  ],
  "pagination": {
    "next_cursor": "cursor_12345",
    "has_more": true
  }
}

Error Response (400)

{
  "status": 400,
  "title": "Invalid request parameters",
  "detail": "The 'name' field is required and must be a non-empty string.",
  "instance": "/resource",
  "type": "https://arize.com/docs/ax/rest-reference/errors#invalid-request"
}

Error Response (401)

{
  "status": 401,
  "title": "Authentication required",
  "detail": "You must be authenticated to access this resource.",
  "instance": "/resource",
  "type": "https://arize.com/docs/ax/rest-reference/errors#authentication-required"
}

Error Response (404)

{
  "status": 404,
  "title": "Resource not found",
  "detail": "The requested resource with ID '12345' was not found.",
  "instance": "/resource/12345",
  "type": "https://arize.com/docs/ax/rest-reference/errors#resource-not-found"
}

Error Response (429)

{
  "status": 429,
  "title": "Rate limit exceeded",
  "detail": "You have exceeded the allowed number of requests. Please try again later.",
  "instance": "/resource",
  "type": "https://arize.com/docs/ax/rest-reference/errors#rate-limit-exceeded"
}