curl --request GET \
--url https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId}"
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}/classroom/lessons/{publicId}', 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}/classroom/lessons/{publicId}",
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}/classroom/lessons/{publicId}"
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}/classroom/lessons/{publicId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId}")
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": {
"public_id": "<string>",
"title": "<string>",
"type": "video",
"course_public_id": "<string>",
"module_title": "<string>",
"progress": {
"completed": true,
"last_position_seconds": 123,
"completed_at": "2023-11-07T05:31:56Z"
},
"description": "<string>",
"body": "<unknown>",
"playback": {
"kind": "video",
"provider": "bunny_stream",
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"signed": true,
"thumbnail_url": "<string>",
"duration_seconds": 123,
"title": "<string>"
},
"attachments": [
{
"kind": "video",
"provider": "bunny_stream",
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"signed": true,
"thumbnail_url": "<string>",
"duration_seconds": 123,
"title": "<string>"
}
],
"duration_seconds": 123,
"previous_public_id": "<string>",
"next_public_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Assistir aula
Corpo, vídeo e navegação; exige direito e liberação.
curl --request GET \
--url https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId}"
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}/classroom/lessons/{publicId}', 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}/classroom/lessons/{publicId}",
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}/classroom/lessons/{publicId}"
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}/classroom/lessons/{publicId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.weve.cx/v1/clubs/{clubId}/classroom/lessons/{publicId}")
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": {
"public_id": "<string>",
"title": "<string>",
"type": "video",
"course_public_id": "<string>",
"module_title": "<string>",
"progress": {
"completed": true,
"last_position_seconds": 123,
"completed_at": "2023-11-07T05:31:56Z"
},
"description": "<string>",
"body": "<unknown>",
"playback": {
"kind": "video",
"provider": "bunny_stream",
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"signed": true,
"thumbnail_url": "<string>",
"duration_seconds": 123,
"title": "<string>"
},
"attachments": [
{
"kind": "video",
"provider": "bunny_stream",
"url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"signed": true,
"thumbnail_url": "<string>",
"duration_seconds": 123,
"title": "<string>"
}
],
"duration_seconds": 123,
"previous_public_id": "<string>",
"next_public_id": "<string>"
}
}{
"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 aluno, emitido por /v1/auth/sign-in e
verificado contra a nossa tabela — não é JWT e não se lê nada dele.
A ida ao banco não é custo novo: toda requisição autenticada já resolve o dono da sessão. Em troca, encerrar uma sessão vale no mesmo instante, sem lista de bloqueio nem janela de tolerância.
O classroom o guarda em cookie host-only: um cookie de domínio o mandaria para os subdomínios dos outros clubs.
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.
A chave curta da URL do classroom.
1 - 32Response
A aula
Show child attributes
Show child attributes