Pular para o conteúdo
Entrar Lista de espera

Salvar preferências

PUT /v1/preferences escopo write

Muda as preferências. Parcial (só muda o que for enviado) e estrito (campo ou valor desconhecido dá 422 invalid_field). Devolve as preferências completas. Os e-mails de Com email true o servidor manda por e-mail postSent, postFailed, scheduledFail, o weeklySummary (segunda 08:00 de São Paulo) e o newComment (agrupado, no máximo um e-mail por hora); com panel true o evento entra na central de avisos (GET /v1/notifications).

CabeçalhosAuthorization: Bearer praeko_… e X-Praeko-Contract: en. Sempre envie os dois.

Corpo da requisição

JSON. Campos obrigatórios precisam ir; os outros podem ser omitidos. Campo que não está na tabela é recusado. Estrito: campo ou valor desconhecido dá 422 invalid_field. Parcial: só o que for enviado muda.

Campo Tipo Descrição
theme (opcional) texto Tema do painel. Valores: light, dark, system.
language (opcional) texto Idioma do painel. Valores: pt-BR, en.
notifications (opcional) objeto Avisos por evento. Só os eventos enviados mudam.
notifications.postSent (opcional) objeto Onde avisar este evento.
notifications.postSent.email (opcional) verdadeiro/falso Avisar por e-mail.
notifications.postSent.panel (opcional) verdadeiro/falso Avisar no painel.
notifications.postFailed (opcional) objeto Onde avisar este evento.
notifications.postFailed.email (opcional) verdadeiro/falso Avisar por e-mail.
notifications.postFailed.panel (opcional) verdadeiro/falso Avisar no painel.
notifications.scheduledFail (opcional) objeto Onde avisar este evento.
notifications.scheduledFail.email (opcional) verdadeiro/falso Avisar por e-mail.
notifications.scheduledFail.panel (opcional) verdadeiro/falso Avisar no painel.
notifications.weeklySummary (opcional) objeto Onde avisar este evento.
notifications.weeklySummary.email (opcional) verdadeiro/falso Avisar por e-mail.
notifications.weeklySummary.panel (opcional) verdadeiro/falso Avisar no painel.
notifications.newComment (opcional) objeto Onde avisar este evento.
notifications.newComment.email (opcional) verdadeiro/falso Avisar por e-mail.
notifications.newComment.panel (opcional) verdadeiro/falso Avisar no painel.
Exemplo de corpo
{
  "theme": "dark",
  "language": "pt-BR",
  "notifications": {
    "postFailed": {
      "email": true,
      "panel": true
    },
    "weeklySummary": {
      "email": false
    }
  }
}

Exemplo

curl -X PUT "https://praeko.app/v1/preferences" \
  -H "Authorization: Bearer $PRAEKO_KEY" \
  -H "X-Praeko-Contract: en" \
  -H "Content-Type: application/json" \
  -d '{
  "theme": "dark",
  "language": "pt-BR",
  "notifications": {
    "postFailed": {
      "email": true,
      "panel": true
    },
    "weeklySummary": {
      "email": false
    }
  }
}'

Resposta

Status de sucesso Quando
200 Sucesso.
Resposta 200
{
  "theme": "dark",
  "language": "pt-BR",
  "notifications": {
    "postSent": {
      "email": false,
      "panel": true
    },
    "postFailed": {
      "email": true,
      "panel": true
    },
    "scheduledFail": {
      "email": false,
      "panel": true
    },
    "weeklySummary": {
      "email": false,
      "panel": true
    },
    "newComment": {
      "email": false,
      "panel": true
    }
  }
}

Erros

Status code Quando
400 empty_body O corpo veio vazio.
400 invalid_json O corpo não é um objeto JSON.
413 body_too_large O corpo passa de 1 MB.
422 invalid_field Campo, evento, canal ou valor desconhecido.

Erros de qualquer rota

Status code Quando
401 unauthorized Faltou o cabeçalho Authorization: Bearer ….
401 invalid_api_key A chave não existe.
401 revoked_api_key A chave foi revogada.
401 expired_api_key A chave expirou.
403 forbidden O escopo da chave não basta para esta rota (veja o selo de escopo).
429 rate_limited Passou do limite de requisições por minuto.

O corpo de todo erro é { "error": { "code", "message", "details"? } }. Veja todos os códigos.

Testar

Testar

O teste ao vivo usa a sua chave e a sua conta. Para quem não entrou, fica desligado.

Entre para testar
Dúvida ou erro nesta página? contato@praeko.appVer .md

Digite para buscar páginas, rotas e códigos de erro.