Workspace
Mudar papel do membro
Muda papel e, opcionalmente, o escopo por número. Promover a ADMIN limpa o escopo: ADMIN é workspace-wide, e guardar restrição que o gate ignora faria a resposta mentir.
Exige OAuth. Chave clássica (x-api-key) é recusada: numa requisição x-api-key não há usuário por trás, e permitir escrita na lista de membros faria de qualquer chave do workspace um caminho de takeover da conta.
PATCH
/
v1
/
workspace
/
members
/
{id}
Mudar papel do membro
curl --request PATCH \
--url https://pilotstatus.com.br/v1/workspace/members/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"role": "ADMIN",
"allowedNumberIds": [
"<string>"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/workspace/members/{id}"
payload = {
"role": "ADMIN",
"allowedNumberIds": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'ADMIN', allowedNumberIds: ['<string>']})
};
fetch('https://pilotstatus.com.br/v1/workspace/members/{id}', 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://pilotstatus.com.br/v1/workspace/members/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'role' => 'ADMIN',
'allowedNumberIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-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://pilotstatus.com.br/v1/workspace/members/{id}"
payload := strings.NewReader("{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-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.patch("https://pilotstatus.com.br/v1/workspace/members/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/workspace/members/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAutorizações
apiKeyapiKeyId
Sua chave de API ps_
Parâmetros de caminho
Id da membership (o id que a listagem devolve), NÃO o id do usuário.
Corpo
application/json
Resposta
Membro atualizado
Esta página foi útil?
⌘I
Mudar papel do membro
curl --request PATCH \
--url https://pilotstatus.com.br/v1/workspace/members/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"role": "ADMIN",
"allowedNumberIds": [
"<string>"
]
}
'import requests
url = "https://pilotstatus.com.br/v1/workspace/members/{id}"
payload = {
"role": "ADMIN",
"allowedNumberIds": ["<string>"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({role: 'ADMIN', allowedNumberIds: ['<string>']})
};
fetch('https://pilotstatus.com.br/v1/workspace/members/{id}', 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://pilotstatus.com.br/v1/workspace/members/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'role' => 'ADMIN',
'allowedNumberIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-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://pilotstatus.com.br/v1/workspace/members/{id}"
payload := strings.NewReader("{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-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.patch("https://pilotstatus.com.br/v1/workspace/members/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/workspace/members/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"role\": \"ADMIN\",\n \"allowedNumberIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body