رفتن به محتوا
cloudhostمستندات
مرجع API

ورک‌فلو

مرحله‌های یک کار طولانی که بعد از هر خطا یا جابه‌جایی از همان‌جا ادامه می‌دهد.

توضیح هر مسیر به انگلیسی است، همان متنی که مرجع از کد ساخته می‌شود. مسیرها، نام فیلدها و کدها همان‌اند که در درخواست می‌نویسید.
GET/v1/workflows/config

Whether workflows are served#

available: whether runs can be started and read here.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پاسخ

200object

  • availableboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/workflows/config" \
  -H "Authorization: Bearer $KEY"
GET/v1/workflows/runs

The team's runs#

Every project's runs, oldest first, or one project's with project.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • statusstringکوئری

    only runs in this state

    one of running, sleeping, waiting, completed, failed, cancelled

  • functionstringکوئری

    only this function's runs (its name or id; in the team's list <project>/<name>)

  • any
  • any

پاسخ

200object

  • runsWorkflowRun[]
    • idstring

      run_…

    • functionstring

      the function whose workflow it runs (null once that function is deleted)

    • kindstring
    • projectobject
    • versionstring

      the deployment it started on; it keeps it across later deploys

    • statusstring

      one of running, sleeping, waiting, completed, failed, cancelled

    • inputany
    • outputany
    • errorstring
    • idempotency_keystring
    • stepsinteger

      finished steps

    • currentstring

      the step being retried, slept or waited

    • attemptinteger

      failed attempts of the current step

    • wake_atstring (date-time)
    • wait_forstring

      the event type a waiting run waits for

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • next_cursorstring

خطاها

وضعیتتوضیح
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl "https://api.ibel.ai/v1/workflows/runs" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/runs

A project's runs#

The runs of the project's functions, oldest first.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • anyالزامی
  • statusstringکوئری

    only runs in this state

    one of running, sleeping, waiting, completed, failed, cancelled

  • functionstringکوئری

    only this function's runs (its name or id; in the team's list <project>/<name>)

  • any
  • any

پاسخ

200object

  • runsWorkflowRun[]
    • idstring

      run_…

    • functionstring

      the function whose workflow it runs (null once that function is deleted)

    • kindstring
    • projectobject
    • versionstring

      the deployment it started on; it keeps it across later deploys

    • statusstring

      one of running, sleeping, waiting, completed, failed, cancelled

    • inputany
    • outputany
    • errorstring
    • idempotency_keystring
    • stepsinteger

      finished steps

    • currentstring

      the step being retried, slept or waited

    • attemptinteger

      failed attempts of the current step

    • wake_atstring (date-time)
    • wait_forstring

      the event type a waiting run waits for

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • next_cursorstring

خطاها

وضعیتتوضیح
400Bad request: bad_param, bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/workflows/runs

Start a run#

Starts the workflow of one of the project's functions with input. With an idempotency_key already used, the same run is answered (200, created: false).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • anyالزامی

بدنهٔ درخواستapplication/json

  • functionstringالزامی

    the function's name in the project (any case) or its id

  • inputany

    any JSON value, given to the workflow as its event

  • idempotency_keystring

    1 to 128 letters, digits, ., :, _ or -; a start with a key used before answers that run

پاسخ

200WorkflowRunThe run started before with this idempotency key

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

201WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)
  • createdboolean

خطاها

وضعیتتوضیح
400Bad request: bad_function, bad_idempotency_key, bad_request, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, account_blocked
404Not found: not_found
409Conflict: not_deployed (the function has no live version)
413Too large: too_large
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs" \
  -H "Authorization: Bearer $KEY" \
  -d '{"function":"…"}'
GET/v1/projects/{project}/workflows/runs/{id}

One run#

Its state, input, output, error and the step it is on.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • idstringمسیرالزامی

    the run's id (run_…)

  • anyالزامی

پاسخ

200WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

خطاها

وضعیتتوضیح
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/runs/{id}/history

A run's history#

Every line of the run's history in order (started, each step and retry with its attempt and error, sleeps, waits, events, the end) and each finished step's result.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • idstringمسیرالزامی

    the run's id (run_…)

  • anyالزامی
  • any
  • any

پاسخ

200object

  • runWorkflowRun
  • historyWorkflowEntry[]
  • resultsobject

    each finished step's result, by the step's name

  • next_cursorstring

خطاها

وضعیتتوضیح
400Bad request: bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/history" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/workflows/runs/{id}/events

Send an event to a run#

An event for a step that waits for its type; one that arrives early is kept for it. The same id twice is kept once (stored: false).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • idstringمسیرالزامی

    the run's id (run_…)

  • anyالزامی

بدنهٔ درخواستapplication/json

  • typestringالزامی

    1 to 128 letters, digits, ., :, _ or -

  • idstring

    the event's own id, the same characters (default a new one)

  • payloadany

    any JSON value

پاسخ

200object

  • runstring
  • typestring
  • idstring
  • storedboolean

خطاها

وضعیتتوضیح
400Bad request: bad_event, bad_request, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
409Conflict: run_finished
413Too large: too_large
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/events" \
  -H "Authorization: Bearer $KEY" \
  -d '{"type":"…"}'
POST/v1/projects/{project}/workflows/runs/{id}/cancel

Cancel a run#

Stops the run: no further step starts.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • idstringمسیرالزامی

    the run's id (run_…)

  • anyالزامی

پاسخ

200WorkflowRun

  • idstring

    run_…

  • functionstring

    the function whose workflow it runs (null once that function is deleted)

  • kindstring
  • projectobject
  • versionstring

    the deployment it started on; it keeps it across later deploys

  • statusstring

    one of running, sleeping, waiting, completed, failed, cancelled

  • inputany
  • outputany
  • errorstring
  • idempotency_keystring
  • stepsinteger

    finished steps

  • currentstring

    the step being retried, slept or waited

  • attemptinteger

    failed attempts of the current step

  • wake_atstring (date-time)
  • wait_forstring

    the event type a waiting run waits for

  • created_atstring (date-time)
  • updated_atstring (date-time)

خطاها

وضعیتتوضیح
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
409Conflict: run_finished
500internal: an unexpected failure
503Unavailable: workflows_unavailable (try again shortly)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/workflows/runs/88e2fe1d-6d75-4de5-8c8f-27380ec66903/cancel" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/workflows/usage

Runs and steps used#

Runs started and steps run per day by the project's functions, and their cost at list price once a step has a price (priced).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • daysintegerکوئری

    how many days back (default 30, at most 90)

    1–90

پاسخ

200object

  • daysinteger
  • runsinteger
  • stepsinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

خطاها

وضعیتتوضیح
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/workflows/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/workflows/usage

The team's runs and steps#

Runs started and steps run per day by every project's functions added up (the team view), or one project's with project, and their cost at list price once a step has a price (priced). project in the answer is the project asked for, or null.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • daysintegerکوئری

    how many days back: 1 to 90 (default 30)

    1–90 · default 30

پاسخ

200object

  • daysinteger
  • runsinteger
  • stepsinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

خطاها

وضعیتتوضیح
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found (no such project)
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/workflows/usage" \
  -H "Authorization: Bearer $KEY"