Pular para o conteúdo principal

API Examples (Request/Response)

Base URL (local): http://localhost/api

Autenticacao

Token de servico (rest_auth_validate_token)

Header esperado:

Authorization: Svc <API_SERVICE_TOKEN>

Fonte: we-dhedalos/functions/rest/auth_callback.php:2

Sessao WordPress (is_user_logged_in)

Exemplo de header:

Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>

1) Busca resumida (GET /dhedalos/v1/search)

Fonte: we-dhedalos/functions/rest/search_summary.php:6

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/search?s=empreendedorismo&max_items=5'

Response 200 (shape real):

{
"total_found": 123,
"total_posts_pages": 13,
"items_per_page": 5,
"data": [
{
"title": "Titulo do post",
"id": 999,
"post_name": "titulo-do-post",
"excerpt": "Resumo...",
"url": "/slug-do-post/",
"category": []
}
]
}

2) Modo manutencao (GET /dhedalos/v1/maintenance_mode?slug=hub|cadastro)

Fonte: we-dhedalos/functions/rest/maintenance_mode.php:30

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/maintenance_mode?slug=hub'

Response 200:

{
"active": true,
"fields": {
"title": "Titulo configurado",
"message": "Mensagem configurada",
"description": "Descricao configurada"
}
}

3) Criar pessoa (POST /dhedalos/v1/registration/people)

Fonte: we-dhedalos/functions/rest/registration/signup.php:6

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/registration/people' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Pessoa Exemplo",
"cpf": "12345678901",
"email": "pessoa@example.com",
"phone": "11999999999",
"gender": "feminino",
"birthday": "1990-01-01"
}'

Response 201:

{
"ID": 321,
"cpf": "12345678901",
"email": "pessoa@example.com",
"name": "Pessoa Exemplo",
"phone": "11999999999",
"gender": "feminino",
"birthday": "1990-01-01"
}

Response 400 (exemplo real):

{
"code": "campos_faltando",
"message": "Todos os campos são de preenchimento obrigatórios.",
"data": { "status": 400 }
}

4) Buscar pessoa por CPF (GET /dhedalos/v1/registration/people/{cpf})

Fonte: we-dhedalos/functions/rest/registration/find.php:7

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/registration/people/12345678901' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>'

Response 200:

{
"id": 321,
"cpf": "12345678901",
"email": "pessoa@example.com",
"name": "Pessoa Exemplo",
"phone": "11999999999",
"gender": "feminino",
"birthday": "1990-01-01"
}

Response 404:

{
"code": "usuario_nao_encontrado",
"message": "Nenhum usuário encontrado com este CPF.",
"data": { "status": 404 }
}

5) Atualizacao parcial (PATCH /dhedalos/v1/registration/people/{id})

Fonte: we-dhedalos/functions/rest/registration/update_patch.php:8

Request:

curl --request PATCH \
--url 'http://localhost/api/dhedalos/v1/registration/people/321' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"participant_phone_number": "11988888888",
"company_name": "Empresa Exemplo"
}'

Response 200:

{
"message": "Usuário atualizado com sucesso.",
"updated_fields": {
"company_name": "Empresa Exemplo",
"participant_phone_number": "11988888888"
}
}

6) Status de inscricao por curso (GET /dhedalos/v1/enroll/{slug_curso}/status)

Fonte: we-dhedalos/functions/rest/course/enroll_open.php:12

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/enroll/decola-mei/status' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>'

Response 200 (disponivel):

{
"available": true,
"cycle": {},
"classes_available": [],
"turns_available": []
}

Response 200 (indisponivel):

{
"available": false
}

7) Salvar metadados de inscricao (POST /dhedalos/v1/enroll/{slug_curso}/meta)

Fonte: we-dhedalos/functions/rest/course/enroll_meta.php:12

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/enroll/decola-mei/meta' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"user_id": 321,
"meta": {
"company_main_activity": "Comercio"
}
}'

Response 201:

{
"status": true
}

Response 400:

{
"code": "user_not_found",
"message": "Usuário não encontrado",
"data": { "status": 400 }
}

8) Inscrever usuario (POST /dhedalos/v1/enroll/{slug_curso})

Fonte: we-dhedalos/functions/rest/course/enroll.php:12

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/enroll/decola-mei' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"user_id": 321,
"turn": "19h"
}'

Response 201:

{
"enroll_id": 456,
"course_slug": "decola-mei",
"class": {},
"cycle": {
"name": "Nome do ciclo",
"start_date": "2026-02-01",
"end_date": "2026-03-01"
},
"user": {
"name": "Pessoa Exemplo",
"phone": "11999999999"
}
}

Response 400 (exemplo real):

{
"code": "enroll_not_available",
"message": "Não existem turmas disponíveis para cadastro",
"data": { "status": 400 }
}

9) Cancelar matricula (usuario logado) (POST /dhedalos/v1/enroll/cancel/{enrollment_id})

Fonte: we-dhedalos/functions/rest/course/enroll.php:280

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/enroll/cancel/456' \
--header 'Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>' \
--header 'Content-Type: application/json' \
--data '{"reason":"Nao poderei participar"}'

Response 200:

{
"enrollment_id": 456,
"status": "cancelled",
"reason": "Nao poderei participar",
"cancel_date": "2026-02-12 10:30:00"
}

Response 403:

{
"code": "not_allowed",
"message": "Você não pode cancelar a matrícula de outro usuário",
"data": { "status": 403 }
}

Response 401:

{
"code": "rest_api_unauthorized",
"message": "Você deve estar logado para cancelar sua matricula.",
"data": { "status": 401 }
}

Response 404:

{
"code": "enroll_not_found",
"message": "Matrícula não encontrada",
"data": { "status": 404 }
}

9.1) Situacao de matricula por curso (GET /dhedalos/v1/course/enrolled/{slug_curso}/{user_id})

Fonte: we-dhedalos/functions/rest/course/enrolled.php:3, we-dhedalos/functions/rest/course/enrolled.php:22

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/course/enrolled/decola-mei/321' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>'

Response 200:

{
"enrolled": true,
"enrolls": [],
"enrolled_in_same_category": false,
"enrolled_in_concurrent_course": true,
"enrolled_in_concurrent_course_detail": [
{
"class_id": "456",
"start_date": "2026-02-01 19:00:00",
"end_date": "2026-03-01 21:00:00",
"course_name": "Nome do curso",
"block": "1",
"is_canceled": ""
}
]
}

Response 404:

{
"code": "no_user",
"message": "Usuário não encontrado",
"data": { "status": 404 }
}

Fonte: we-dhedalos/functions/rest/course/group_link.php:12

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/group/456' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>'

Response 200:

{
"ok": true,
"meta": true,
"enroll_id": 456,
"class": 789,
"group_link": "https://chat.whatsapp.com/..."
}

Response 400:

{
"message": "Inscrição inválida",
"ok": false
}

11) Live enrollments (GET /dhedalos/v1/live/enrollments)

Fonte: we-dhedalos/functions/rest/live/enrollments.php:3

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/live/enrollments?date=2026-02-10' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>'

Response 200:

{
"data": [
{
"id": 1001,
"date_hour": "2026-02-10 09:00:00",
"course_name": "Nome curso",
"class_name": "Nome turma",
"course_color": "#FF6B35",
"cycle": "Ciclo X",
"shift": "noite",
"name": "Participante",
"cpf": "12345678901",
"phone": "11999999999",
"email": "pessoa@example.com",
"uf": "SP",
"city": "Sao Paulo",
"segment": "Tecnologia",
"company_size": "ME",
"cnpj": "12345678000190"
}
],
"count": 1,
"timestamp": 1760000000
}

12) Criar fixtures de teste (POST /dhedalos/v1/tests/fixtures/create)

Fonte: we-dhedalos/functions/rest/tests-fixtures.php:46

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/tests/fixtures/create' \
--header 'Authorization: Svc <API_SERVICE_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"cycles_count": 2,
"students_per_class": 4,
"enable_room": true,
"enable_calendar": true,
"is_group_meetings_enabled": false,
"enable_certificacao_progressiva": false
}'

Response 201:

{
"status": 201,
"message": "Test fixtures created successfully",
"data": []
}

Response 500:

{
"code": "fixture_creation_failed",
"message": "<mensagem da excecao>",
"data": { "status": 500 }
}

13) Solicitar cancelamento de inscricao (POST /dhedalos/v1/enrollment/{enrollment_id}/request-cancellation)

Fonte: we-dhedalos/functions/rest/classes.php:423, we-dhedalos/functions/rest/classes.php:2693

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/enrollment/456/request-cancellation' \
--header 'Content-Type: application/json'

Response 200:

{
"success": true,
"message": "Solicitação de cancelamento registrada com sucesso.",
"enrollment_id": 456,
"requested_at": "2026-02-12 11:20:00",
"requested_by": "Nome Usuario",
"status": 200
}

Response 400:

{
"code": "enrollment_already_canceled",
"message": "A inscrição já foi cancelada.",
"data": { "status": 400 }
}

Response 404:

{
"code": "enrollment_not_found",
"message": "Inscrição não encontrada.",
"data": { "status": 404 }
}

14) Status de recuperação (GET /dhedalos/v1/cycles/recovery-status)

Fonte: we-dhedalos/functions/rest/cycles.php:147, we-dhedalos/functions/rest/cycles.php:605

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/cycles/recovery-status?class_idd=789' \
--header 'Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>'

Response 200 (presence_missing):

{
"status": 200,
"message": "Usuário não possui presença no último encontro coletivo.",
"code": "presence_missing",
"data": {
"user_id": 321,
"class_id": 789,
"cycle_id": 654,
"collective_meeting_index": 2,
"collective_meeting_name": "Encontro 2",
"collective_meeting_time": "15/02/2026 19:00:00",
"has_presence": false,
"recovery_hours_configured": 48,
"collective_meeting_duration": 2.0,
"recovery_deadline": "17/02/2026 21:00:00",
"recovery_expired": false,
"time_remaining": 12.5,
"recovery_video": "abc123",
"enable_strategic_activities": true,
"now": "17/02/2026 08:30:00"
}
}

Response 404 (no_active_enrollment):

{
"status": 404,
"message": "Nenhuma inscrição ativa encontrada para este usuário nesta turma.",
"code": "no_active_enrollment"
}

15) Presença por recuperação (POST /dhedalos/v1/class/{class_id}/recovery-presence/{activity})

Fonte: we-dhedalos/functions/rest/classes.php:333, we-dhedalos/functions/rest/classes.php:704

Request:

curl --request POST \
--url 'http://localhost/api/dhedalos/v1/class/789/recovery-presence/2' \
--header 'Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>' \
--header 'Content-Type: application/json' \
--data '{"reason":"Assisti à gravação dentro do prazo"}'

Response 200:

{
"message": "Presença registrada com sucesso"
}

Response 403:

{
"code": "rest_forbidden",
"message": "Aluno não pertence a essa turma",
"data": { "status": 403 }
}

16) Turmas do participante com status de recuperação (GET /dhedalos/v1/classes/subscriber)

Fonte: we-dhedalos/functions/rest/classes.php:107, we-dhedalos/functions/rest/classes.php:1661

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/classes/subscriber' \
--header 'Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>'

Response 200 (trecho relevante):

[
{
"id": 789,
"title": "Turma Noite",
"has_pending_recovery": true,
"has_expired_recovery": {
"status": false,
"activity": ""
}
}
]

17) Presenças por turma com requisitos mínimos (GET /dhedalos/v1/class/{class_id}/presence)

Fonte: we-dhedalos/functions/rest/classes.php:734, we-dhedalos/functions/rest/classes.php:1096

Request:

curl --request GET \
--url 'http://localhost/api/dhedalos/v1/class/789/presence' \
--header 'Cookie: wordpress_logged_in_xxx=<SESSION_COOKIE>'

Response 200 (trecho relevante por participante):

[
{
"id": 321,
"name": "Participante",
"enrollment_id": 456,
"login_hub": true,
"acesso_whatsapp": true,
"min_requirement": true
}
]

Pendencias

  • Nao foi encontrada collection Postman/Insomnia neste repositorio para usar como fonte adicional.
  • Diversos endpoints retornam objetos montados dinamicamente com ACF/meta queries. Nesses casos, o OpenAPI esta intencionalmente com schema minimo (additionalProperties: true).
  • WP_REST_Server::EDITABLE pode aceitar mais de um verbo HTTP dependendo do contexto WordPress; o endpoint de request-cancellation esta exemplificado com POST por padrao operacional atual.
  • A rota GET /dhedalos/v1/cycles/recovery-status usa class_idd como nome de parâmetro no código atual.