Python (SDK)
import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.rbac.update_role()
# Handle response
print(res)import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.rbac.updateRole({
body: {},
});
console.log(result);
}
run();curl --request POST \
--url https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"roleId": "<string>",
"name": "<string>",
"description": "<string>",
"defaultModelId": 123,
"allowedModelIds": [
123
],
"allowModelChoice": true,
"clearAllowedModelIds": true
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
roleId: '<string>',
name: '<string>',
description: '<string>',
defaultModelId: 123,
allowedModelIds: [123],
allowModelChoice: true,
clearAllowedModelIds: true
})
};
fetch('https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole', 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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole",
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([
'roleId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'defaultModelId' => 123,
'allowedModelIds' => [
123
],
'allowModelChoice' => true,
'clearAllowedModelIds' => true
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole"
payload := strings.NewReader("{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}"
response = http.request(request)
puts response.read_body{
"role": {
"id": "<string>",
"orgId": "<string>",
"name": "<string>",
"description": "<string>",
"isSystem": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"defaultModelId": 123,
"allowedModelIds": [
123
],
"allowModelChoice": true,
"isScimManaged": true
}
}{
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}RBAC Service
Update Role
POST
/
textql.rpc.public.rbac.RBACService
/
UpdateRole
Python (SDK)
import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.rbac.update_role()
# Handle response
print(res)import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.rbac.updateRole({
body: {},
});
console.log(result);
}
run();curl --request POST \
--url https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"roleId": "<string>",
"name": "<string>",
"description": "<string>",
"defaultModelId": 123,
"allowedModelIds": [
123
],
"allowModelChoice": true,
"clearAllowedModelIds": true
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
roleId: '<string>',
name: '<string>',
description: '<string>',
defaultModelId: 123,
allowedModelIds: [123],
allowModelChoice: true,
clearAllowedModelIds: true
})
};
fetch('https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole', 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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole",
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([
'roleId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'defaultModelId' => 123,
'allowedModelIds' => [
123
],
'allowModelChoice' => true,
'clearAllowedModelIds' => true
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole"
payload := strings.NewReader("{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_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://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/textql.rpc.public.rbac.RBACService/UpdateRole")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"roleId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"defaultModelId\": 123,\n \"allowedModelIds\": [\n 123\n ],\n \"allowModelChoice\": true,\n \"clearAllowedModelIds\": true\n}"
response = http.request(request)
puts response.read_body{
"role": {
"id": "<string>",
"orgId": "<string>",
"name": "<string>",
"description": "<string>",
"isSystem": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"defaultModelId": 123,
"allowedModelIds": [
123
],
"allowModelChoice": true,
"isScimManaged": true
}
}{
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}Authorizations
Headers
Define the version of the Connect protocol
Available options:
1 Define the timeout, in ms
Body
application/json
Wrapper message for int32.
The JSON representation for Int32Value is JSON number.
Not recommended for use in new APIs, but still useful for legacy APIs and has no plan to be removed.
Wrapper message for bool.
The JSON representation for BoolValue is JSON true and false.
Not recommended for use in new APIs, but still useful for legacy APIs and has no plan to be removed.
Set to true to clear allowed_model_ids back to "all models allowed". Proto3 cannot distinguish an empty repeated field from an absent one, so this explicit flag is required.
Response
Success
Show child attributes
Show child attributes
⌘I