agency-time

POST /v1/agency/time/schedules

Set a client's billing trigger.

Bütün agency-time nöqtələri

Doğrulama

API açarını bearer token kimi göndərin. Bu səhifə spresifikasiyada xüsusi icazə tələb etmir, buna görə də açarınıza ehtiyac duyduğu minimum səviyyədə icazə verin və güman etmək əvəzinə cavabı yoxlayın.

Təşkilatınızın identifikatorunun yerləşdiyi yer

Bu son nöqtə JSON gövdəsində sahə kimi org_id qəbul edir.

Təşkilatınızın identifikatoru idarə panelinizdəki API açarları ekranında, açarın özünün yanında yerləşir. Bu, etdiyiniz hər bir sorğuda eyni identifikatordur.

Sınaqdan keçir

Bucaqlı mötərizələrdə olan hór şeyi öz qiymətlərinizlə, açar yertutucusunu isə idarə panelinizdən bir açarla əvəz edin.

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>> }'

Sistemə daxil olmusunuz? İdarə panelinizdəki API konsolu real təşkilatınızın identifikatorunu və öz açarınızı avtomatik doldurur, sorğunu canlı API-yə qarşı icra edir ki, siz faktiki cavabı görə biləsiniz. Bu son nöqtəni API konsolunda açın

Təfərrüatlar

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.

Sorğu gövdəsi

AdTipTələb olunurNədir
client_idstringXeyr
triggerstring<manual, on_log, day_of_month, threshold>Bəli
day_of_monthintegerXeyr
threshold_minorintegerXeyr
currencystringXeyr
activebooleanXeyr
org_idstringXeyr

Cavab

AdTipTələb olunurNədir
idstringBəli
client_idstringXeyr`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.
triggerstring<manual, on_log, day_of_month, threshold>Bəli
day_of_monthintegerXeyr⛔ 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_minorintegerXeyr
currencystringBəli
activebooleanBəli
next_run_atstringXeyr
last_attempted_atstringXeyrStamped 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_atstringXeyrA SECOND column, deliberately: one column cannot serve as both the cursor the sweep advances and the signal a staleness alarm reads.
last_errorstringXeyr

Bu son nöqtənin qaytara biləcəyi xətalar

401 · 403 · 422