curl --request POST \
--url https://api.useweve.com/v1/clubs/{clubId}/bulk-actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target_query": {
"search": "<string>",
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"target_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"delivery_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cohort_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"days": 1825
}
'import requests
url = "https://api.useweve.com/v1/clubs/{clubId}/bulk-actions"
payload = {
"target_query": {
"search": "<string>",
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"target_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"delivery_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cohort_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"days": 1825
}
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({
target_query: {search: '<string>', tag_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
target_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
tag_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
delivery_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cohort_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expires_at: '2023-11-07T05:31:56Z',
days: 1825
})
};
fetch('https://api.useweve.com/v1/clubs/{clubId}/bulk-actions', 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.useweve.com/v1/clubs/{clubId}/bulk-actions",
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([
'target_query' => [
'search' => '<string>',
'tag_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'target_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'tag_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'delivery_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cohort_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'expires_at' => '2023-11-07T05:31:56Z',
'days' => 1825
]),
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.useweve.com/v1/clubs/{clubId}/bulk-actions"
payload := strings.NewReader("{\n \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\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://api.useweve.com/v1/clubs/{clubId}/bulk-actions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useweve.com/v1/clubs/{clubId}/bulk-actions")
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 \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "students_tag",
"status": "pending",
"total": 123,
"done": 123,
"changed": 123,
"skipped": 123,
"created_at": "2023-11-07T05:31:56Z",
"error": "<string>",
"finished_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Pedir ação em lote
Tag ou acesso para até 5000 alunos: a resposta é 202 com a ação na fila.
curl --request POST \
--url https://api.useweve.com/v1/clubs/{clubId}/bulk-actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target_query": {
"search": "<string>",
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"target_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"delivery_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cohort_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"days": 1825
}
'import requests
url = "https://api.useweve.com/v1/clubs/{clubId}/bulk-actions"
payload = {
"target_query": {
"search": "<string>",
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"target_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"tag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"delivery_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cohort_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"days": 1825
}
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({
target_query: {search: '<string>', tag_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
target_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
tag_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
delivery_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cohort_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
expires_at: '2023-11-07T05:31:56Z',
days: 1825
})
};
fetch('https://api.useweve.com/v1/clubs/{clubId}/bulk-actions', 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.useweve.com/v1/clubs/{clubId}/bulk-actions",
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([
'target_query' => [
'search' => '<string>',
'tag_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'target_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'tag_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'delivery_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cohort_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'expires_at' => '2023-11-07T05:31:56Z',
'days' => 1825
]),
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.useweve.com/v1/clubs/{clubId}/bulk-actions"
payload := strings.NewReader("{\n \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\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://api.useweve.com/v1/clubs/{clubId}/bulk-actions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useweve.com/v1/clubs/{clubId}/bulk-actions")
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 \"target_query\": {\n \"search\": \"<string>\",\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"target_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"tag_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"delivery_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cohort_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"days\": 1825\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "students_tag",
"status": "pending",
"total": 123,
"done": 123,
"changed": 123,
"skipped": 123,
"created_at": "2023-11-07T05:31:56Z",
"error": "<string>",
"finished_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}status
ser done ou failed.Authorizations
Token OPACO de sessão de quem administra, emitido por
/v1/auth/admin/sign-in e verificado contra a nossa tabela — o mesmo
desenho do studentSession, para a outra identidade.
É o esquema de quem ADMINISTRA — o dashboard. O aluno do classroom usa o
studentSession; uma rota consumida pelos dois declara os dois
esquemas, e o middleware aceita qualquer um deles. As duas credenciais
são opacas e chegam pelo mesmo cabeçalho: quem as separa é a tabela em
que cada uma existe.
O dashboard o guarda em cookie httpOnly, que o BFF troca pelo
Authorization a cada chamada.
Path Parameters
Id público da organização — o mesmo que GET /v1/me devolve em
organization_id.
Na URL o recurso se chama club; no contrato e no domínio, organization.
A divergência é deliberada: clubs é a palavra do produto, e a URL é o que
as pessoas leem.
É o identificador do provedor de autenticação, e é assim de propósito: o cliente precisa nomear a organização ao pedir o token, e o token é o que prova o escopo. Um id só nosso obrigaria a traduzir um no outro antes de ter um token — e a tradução exigiria uma chamada escopada, que é justamente a que ainda não dá para fazer.
O uuid interno da organização não aparece no contrato: ele é o que as chaves estrangeiras do domínio referenciam, e continua sendo nosso.
Body
Quem a ação alcança vem em target_ids OU em target_query — um dos
dois, nunca os dois.
students_tag, students_untag, students_grant, students_cohort, students_expiry "Todos do filtro": os mesmos filtros de GET .../students, resolvidos
pela API NO PEDIDO — a ação alcança quem estava no recorte quando foi
pedida. Contas removidas e as de quem administra o club ficam de fora.
Mais de 5000 alunos no recorte responde 422 selection_too_large.
Show child attributes
Show child attributes
1 - 5000 elementsA tag de students_tag e students_untag.
A entrega de students_grant.
Em students_grant, a mesma regra da concessão individual. Em
students_cohort, obrigatório: a turma de destino.
Em students_grant, o fim do acesso; ausente é o da turma, ou
vitalício. Em students_expiry com expiry_mode date, a data
nova (no futuro).
Em students_expiry: date usa expires_at; add_days soma
days à validade de cada matrícula (a vitalícia continua
vitalícia); from_today é hoje mais days, a mesma data para
todos; lifetime tira a data.
date, add_days, from_today, lifetime Em students_expiry, os dias de add_days e from_today.
1 <= x <= 3650Response
Na fila
Show child attributes
Show child attributes