agency-time
POST /v1/agency/time/schedules
Set a client's billing trigger.
Autenticação
Envie uma chave de API como um token bearer. Este endpoint não especifica uma permissão específica na documentação, portanto, conceda à sua chave o mínimo necessário e verifique a resposta em vez de assumir.
Onde vai o ID da sua organização
Este endpoint aceita org_id como um campo no corpo JSON.
O ID da sua organização está na tela de chaves de API no seu painel, ao lado da própria chave. É o mesmo ID em todas as chamadas que você fizer.
Experimente
Substitua qualquer item entre colchetes por seus próprios valores e o espaço reservado para a chave por uma chave do seu painel.
curl -X POST https://api.zinndigital.com/v1/agency/time/schedules \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "trigger": <string<manual, on_log, day_of_month, threshold>> }'Conectado? O console da API no seu painel preenche o ID da sua organização real e a sua própria chave, e executa a requisição contra a API de produção para que você possa ver a resposta real. Abra este endpoint no console da API
Detalhes
Idempotent by `(org, client)` — a second POST updates rather than creating a second row, because two schedules for one client is the arrangement that bills them twice. Four triggers: `manual` (on demand only), `on_log` (immediately, as time is logged), `day_of_month`, and `threshold` (when unbilled work reaches an amount). ⛔ `day_of_month` is 1–28, and that is not a limitation of the storage. A schedule set to the 31st would silently skip February, April, June, September and November — seven months a year in which the agency is not paid and nothing is red. "The end of the month" is expressed as 28.
Corpo da requisição
| Nome | Tipo | Obrigatório | O que é |
|---|---|---|---|
client_id | string | Não | — |
trigger | string<manual, on_log, day_of_month, threshold> | Sim | — |
day_of_month | integer | Não | — |
threshold_minor | integer | Não | — |
currency | string | Não | — |
active | boolean | Não | — |
org_id | string | Não | — |
Resposta
| Nome | Tipo | Obrigatório | O que é |
|---|---|---|---|
id | string | Sim | — |
client_id | string | Não | `null` is the organisation-wide DEFAULT, covering every client without a row of its own. A per-client row replaces it rather than layering on it. |
trigger | string<manual, on_log, day_of_month, threshold> | Sim | — |
day_of_month | integer | Não | ⛔ 1–28. The 29th to the 31st do not exist in every month, so a schedule set to the 31st would silently skip five of them a year. |
threshold_minor | integer | Não | — |
currency | string | Sim | — |
active | boolean | Sim | — |
next_run_at | string | Não | — |
last_attempted_at | string | Não | Stamped for every schedule the sweep REACHES, before its result is read — so a client whose invoice fails still leaves the front of the queue. |
last_succeeded_at | string | Não | A SECOND column, deliberately: one column cannot serve as both the cursor the sweep advances and the signal a staleness alarm reads. |
last_error | string | Não | — |
Erros que este endpoint pode retornar
401 · 403 · 422