curl --request GET \
--url https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}', 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.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"subject": "<string>",
"preheader": "<string>",
"blocks": [
{
"kind": "heading",
"text": "<string>",
"level": 1,
"url": "<string>",
"media_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"alt": "<string>"
}
],
"audience": {
"include": {
"delivery_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"cohort_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"product_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"completed_course_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"exclude": {
"delivery_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"cohort_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"product_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"completed_course_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"reply_to": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"summary": {
"recipients": 123,
"sent": 123,
"opened": 123,
"clicked": 123
},
"stats": {
"total": 123,
"pending": 123,
"sending": 123,
"sent": 123,
"failed": 123,
"suppressed": 123,
"unreachable": 123,
"canceled": 123,
"delivered": 123,
"bounced": 123,
"complained": 123,
"opened": 123,
"clicked": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Campanha
O conteúdo, a audiência e os números do envio.
curl --request GET \
--url https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}', 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.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/campaigns/{campaignId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"status": "draft",
"subject": "<string>",
"preheader": "<string>",
"blocks": [
{
"kind": "heading",
"text": "<string>",
"level": 1,
"url": "<string>",
"media_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"alt": "<string>"
}
],
"audience": {
"include": {
"delivery_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"cohort_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"product_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"completed_course_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"exclude": {
"delivery_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"cohort_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"product_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"completed_course_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"reply_to": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"summary": {
"recipients": 123,
"sent": 123,
"opened": 123,
"clicked": 123
},
"stats": {
"total": 123,
"pending": 123,
"sending": 123,
"sent": 123,
"failed": 123,
"suppressed": 123,
"unreachable": 123,
"canceled": 123,
"delivered": 123,
"bounced": 123,
"complained": 123,
"opened": 123,
"clicked": 123
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}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.
Response
A campanha
Show child attributes
Show child attributes