curl --request POST \
--url https://developer.synq.io/api/users/v1/roles/batch-set \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"users": [
{
"identity": "<string>",
"roles": [],
"firstName": "<string>",
"lastName": "<string>"
}
],
"dryRun": true
}
'import requests
url = "https://developer.synq.io/api/users/v1/roles/batch-set"
payload = {
"users": [
{
"identity": "<string>",
"roles": [],
"firstName": "<string>",
"lastName": "<string>"
}
],
"dryRun": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [{identity: '<string>', roles: [], firstName: '<string>', lastName: '<string>'}],
dryRun: true
})
};
fetch('https://developer.synq.io/api/users/v1/roles/batch-set', 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://developer.synq.io/api/users/v1/roles/batch-set",
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([
'users' => [
[
'identity' => '<string>',
'roles' => [
],
'firstName' => '<string>',
'lastName' => '<string>'
]
],
'dryRun' => true
]),
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://developer.synq.io/api/users/v1/roles/batch-set"
payload := strings.NewReader("{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://developer.synq.io/api/users/v1/roles/batch-set")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.synq.io/api/users/v1/roles/batch-set")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"identity": "<string>",
"user": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"identities": [
"<string>"
],
"roles": [
"USER_ROLE_UNSPECIFIED"
],
"status": "USER_STATUS_UNSPECIFIED",
"lastLoginAt": "2023-01-15T01:30:15.01Z",
"createdAt": "2023-01-15T01:30:15.01Z",
"etag": "<string>",
"membershipEtag": "<string>",
"invitedAt": "2023-01-15T01:30:15.01Z"
},
"outcome": "USER_ROLES_OUTCOME_UNSPECIFIED"
}
]
}BatchSetUserRoles
Sets the roles of up to 100 users in the workspace in one call.
Each entry names a user and the full set of roles they hold after the call. An “email:” identity of a person who is not a member adds them to the workspace, and creates the user when the email has none, so roles can be set before a person’s first sign-in. No invitation email is sent. Members that no entry names keep their roles; use RemoveUserRole to remove one. The call does not keep an Admin in the workspace: an entry can demote the last one.
A person the call adds to the workspace has the status USER_STATUS_SETUP_PENDING until their sign-in is set up, which takes a few minutes for a large list. The response does not wait for it. Sending the same list again starts the setup again for every listed user with the status USER_STATUS_SETUP_PENDING or USER_STATUS_SETUP_FAILED.
The call changes every listed user or none. It is refused with:
- INVALID_ARGUMENT: an unsupported identity prefix, two entries that name the same user, or an invalid email for a person who is not a member.
- NOT_FOUND: an identity other than “email:” that names no member.
- FAILED_PRECONDITION: an “email:” identity that matches several members; name the member by a “synq:” identity.
- PERMISSION_DENIED: the caller is not an Admin of the workspace, or would change their own roles.
- ABORTED: a listed user changed while the call ran. Send the same request again.
curl --request POST \
--url https://developer.synq.io/api/users/v1/roles/batch-set \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"users": [
{
"identity": "<string>",
"roles": [],
"firstName": "<string>",
"lastName": "<string>"
}
],
"dryRun": true
}
'import requests
url = "https://developer.synq.io/api/users/v1/roles/batch-set"
payload = {
"users": [
{
"identity": "<string>",
"roles": [],
"firstName": "<string>",
"lastName": "<string>"
}
],
"dryRun": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [{identity: '<string>', roles: [], firstName: '<string>', lastName: '<string>'}],
dryRun: true
})
};
fetch('https://developer.synq.io/api/users/v1/roles/batch-set', 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://developer.synq.io/api/users/v1/roles/batch-set",
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([
'users' => [
[
'identity' => '<string>',
'roles' => [
],
'firstName' => '<string>',
'lastName' => '<string>'
]
],
'dryRun' => true
]),
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://developer.synq.io/api/users/v1/roles/batch-set"
payload := strings.NewReader("{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}")
req, _ := http.NewRequest("POST", 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.post("https://developer.synq.io/api/users/v1/roles/batch-set")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developer.synq.io/api/users/v1/roles/batch-set")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"users\": [\n {\n \"identity\": \"<string>\",\n \"roles\": [],\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\"\n }\n ],\n \"dryRun\": true\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"identity": "<string>",
"user": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"identities": [
"<string>"
],
"roles": [
"USER_ROLE_UNSPECIFIED"
],
"status": "USER_STATUS_UNSPECIFIED",
"lastLoginAt": "2023-01-15T01:30:15.01Z",
"createdAt": "2023-01-15T01:30:15.01Z",
"etag": "<string>",
"membershipEtag": "<string>",
"invitedAt": "2023-01-15T01:30:15.01Z"
},
"outcome": "USER_ROLES_OUTCOME_UNSPECIFIED"
}
]
}