Groups Config API
Set group scopes
Replace the group’s scopes. Every scope must be one of the application’s allowed scopes.
PUT
/
v2
/
session
/
apps
/
{appID}
/
config
/
groups
/
{groupName}
Set group scopes
curl --request PUT \
--url https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"admin"
]
}
'import requests
url = "https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}"
payload = { "scopes": ["admin"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: ['admin']})
};
fetch('https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}', 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.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
'admin'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}"
payload := strings.NewReader("{\n \"scopes\": [\n \"admin\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [\n \"admin\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scopes\": [\n \"admin\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "admins",
"scopes": [
"read",
"write"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "invalid_request",
"status": "bad_request",
"message": "The request body is invalid."
}{
"code": "app_not_found",
"status": "not_found",
"message": "The application was not found."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The id of the app the request refers to. An application's unique identifier.
Examples:
"54e9ujn"
"fvua38g"
The name of the group the request refers to. A group name, unique per application.
Maximum string length:
64Pattern:
^[a-zA-Z0-9\-_]+$Example:
"admins"
Body
application/json
The scopes the group owns. Each must be one of the app's allowed scopes.
A scope identifier.
Pattern:
^[a-zA-Z0-9.\-_:]+$⌘I
Set group scopes
curl --request PUT \
--url https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"admin"
]
}
'import requests
url = "https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}"
payload = { "scopes": ["admin"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: ['admin']})
};
fetch('https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}', 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.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
'admin'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}"
payload := strings.NewReader("{\n \"scopes\": [\n \"admin\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [\n \"admin\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prelude.dev/v2/session/apps/{appID}/config/groups/{groupName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scopes\": [\n \"admin\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "admins",
"scopes": [
"read",
"write"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "invalid_request",
"status": "bad_request",
"message": "The request body is invalid."
}{
"code": "app_not_found",
"status": "not_found",
"message": "The application was not found."
}