agency-time
POST /v1/agency/time/schedules
Set a client's billing trigger.
Упълномощаване
Изпратете API ключ като носител (bearer token). Тази точка за достъп не указва конкретно разрешение в спецификацията, затова дайте на ключа си най-малкото необходимо и проверете отговора, вместо да правите предположения.
Където отива идентификаторът на вашата организация
Този краен пункт приема org_id като поле в JSON тялото.
ИД на вашата организация се намира на екрана с API ключове във вашето табло за управление, до самия ключ. Това е същият ИД във всяко заявка, която правите.
Опитайте
Заменете всичко в квадратни скоби със собствени стойности, а ключовия заместващ символ – с ключ от вашето табло за управление.
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>> }'Влязохте ли в профила си? API конзолата във вашето табло за управление попълва действителното идентификационно число на вашата организация и вашия собствен ключ и изпълнява заявката спрямо реалното API, за да можете да видите действителния отговор. Отворете този крайpoint в API конзолата
Детайли
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.
Тяло на заявката
| Име | Тип | Задължително | Какво представлява |
|---|---|---|---|
client_id | string | Не | — |
trigger | string<manual, on_log, day_of_month, threshold> | Да | — |
day_of_month | integer | Не | — |
threshold_minor | integer | Не | — |
currency | string | Не | — |
active | boolean | Не | — |
org_id | string | Не | — |
Отговор
| Име | Тип | Задължително | Какво представлява |
|---|---|---|---|
id | string | Да | — |
client_id | string | Не | `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> | Да | — |
day_of_month | integer | Не | ⛔ 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 | Не | — |
currency | string | Да | — |
active | boolean | Да | — |
next_run_at | string | Не | — |
last_attempted_at | string | Не | 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 | Не | 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 | Не | — |
Грешки, които този крайpoint може да върне
401 · 403 · 422