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

ریپازیتوری‌های Git

اتصال GitHub و GitLab، متصل کردن پروژه به ریپازیتوری، بیلد با هر push و وب‌هوک‌های Git.

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

What can be connected#

GitHub and GitLab availability on this platform.

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

پاسخ

200object

  • githubobject
    • availableboolean
  • gitlabobject
    • availableboolean
    • default_hoststring
    • hostsstring[]
    • custom_hostsboolean

خطاها

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

نمونه

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

The team's Git connections#

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

پاسخ

200object

  • connectionsobject[]
    • idstring (uuid)
    • providerstring

      one of github, gitlab

    • hoststring
    • loginstring | null
    • statusstring

      one of active, revoked

    • own_applicationboolean
    • projectsinteger
    • created_atstring (date-time)

خطاها

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

نمونه

curl "https://api.ibel.ai/v1/repos/connections" \
  -H "Authorization: Bearer $KEY"
POST/v1/repos/connections

Start connecting GitHub or GitLab#

Returns the address to open and approve.

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

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

  • providerstringالزامی

    one of github, gitlab

  • hoststring

    GitLab only: a self-hosted GitLab's https address

  • application_idstring
  • secretstring

پاسخ

200object

  • providerstring
  • idstring
  • authorize_urlstring

خطاها

وضعیتتوضیح
400bad_provider, bad_host, needs_application, bad_application
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
500internal: an unexpected failure
503not_configured: connecting GitHub is not set up on this platform

نمونه

curl -X POST "https://api.ibel.ai/v1/repos/connections" \
  -H "Authorization: Bearer $KEY" \
  -d '{"provider":"github"}'
POST/v1/repos/connections/finish

Finish connecting GitHub or GitLab#

Called by the dashboard when the browser comes back from the Git host with ?finish=<ticket>. Only the person who began the connection, in the team it was begun for, can finish it, once.

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

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

  • ticketstringالزامی

پاسخ

200object

  • connectedstring (uuid)

خطاها

وضعیتتوضیح
400Bad request: expired, failed
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, not_starter, not_yours
409Conflict: taken
500internal: an unexpected failure
502The Git host did not answer: failed

نمونه

curl -X POST "https://api.ibel.ai/v1/repos/connections/finish" \
  -H "Authorization: Bearer $KEY" \
  -d '{"ticket":"…"}'
DELETE/v1/repos/connections/{id}

Remove a Git connection#

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

پارامترها

  • idstring (uuid)مسیرالزامی
  • unlinkbooleanکوئری

    also unlink the projects that use it

پاسخ

200object

  • idstring
  • deletedboolean
  • unlinkedobject[]

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
409in_use: projects are linked; pass unlink=true
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/repos/connections/88e2fe1d-6d75-4de5-8c8f-27380ec66903" \
  -H "Authorization: Bearer $KEY"
GET/v1/repos/connections/{id}/repositories

Repositories a connection can reach#

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

پارامترها

  • idstring (uuid)مسیرالزامی
  • qstringکوئری

    part of a repository name

پاسخ

200object

  • repositoriesobject[]
    • idstring
    • namestring
    • default_branchstring
    • privateboolean
    • projectsobject[]

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure
502provider: the Git host did not answer

نمونه

curl "https://api.ibel.ai/v1/repos/connections/88e2fe1d-6d75-4de5-8c8f-27380ec66903/repositories" \
  -H "Authorization: Bearer $KEY"
POST/v1/repos/import

Make a project from a repository#

Creates the project, links it and builds the production branch.

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

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

  • namestringالزامی
  • kindstring

    one of app, function

  • connectionstringالزامی
  • repostringالزامی

    the repository's id from the repositories list

  • production_branchstring
  • previewsboolean

پاسخ

201objectCreated

  • projectobject
  • repoobject
  • buildstring | null
  • commitstring | null

خطاها

وضعیتتوضیح
400bad_name, bad_kind, bad_connection, bad_repo, bad_branch
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
409name_taken
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/repos/import" \
  -H "Authorization: Bearer $KEY" \
  -d '{"name":"my-api","connection":"…","repo":"…"}'
GET/v1/apps/{name}/repo

The repository a project is built from#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

پاسخ

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY"
PUT/v1/apps/{name}/repo

Link a project to a repository#

Replaces an earlier link. GitLab: adds a webhook to the project.

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

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

  • connectionstringالزامی
  • repostringالزامی
  • production_branchstring
  • previewsboolean

پاسخ

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

خطاها

وضعیتتوضیح
400bad_connection, bad_repo, bad_branch, bad_previews
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure

نمونه

curl -X PUT "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY" \
  -d '{"connection":"…","repo":"…"}'
DELETE/v1/apps/{name}/repo

Stop building a project from its repository#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

پاسخ

200object

  • unlinkedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/apps/my-api/repo" \
  -H "Authorization: Bearer $KEY"
POST/v1/apps/{name}/repo/builds

Build a branch of the linked repository now#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

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

  • branchstring

    default: the production branch

پاسخ

201objectCreated

  • buildstring
  • branchstring
  • commitstring
  • productionboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_linked, no_branch
409not_built
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/apps/my-api/repo/builds" \
  -H "Authorization: Bearer $KEY" \
  -d '{"branch":"dev"}'
GET/v1/functions/{name}/repo

The repository a project is built from#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

پاسخ

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY"
PUT/v1/functions/{name}/repo

Link a project to a repository#

Replaces an earlier link. GitLab: adds a webhook to the project.

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

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

  • connectionstringالزامی
  • repostringالزامی
  • production_branchstring
  • previewsboolean

پاسخ

200object

  • connectionstring
  • providerstring
  • hoststring
  • repostring
  • repo_idstring
  • production_branchstring
  • previewsboolean
  • created_atstring (date-time)

خطاها

وضعیتتوضیح
400bad_connection, bad_repo, bad_branch, bad_previews
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found
500internal: an unexpected failure

نمونه

curl -X PUT "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY" \
  -d '{"connection":"…","repo":"…"}'
DELETE/v1/functions/{name}/repo

Stop building a project from its repository#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

پاسخ

200object

  • unlinkedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_found, not_linked
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/functions/my-api/repo" \
  -H "Authorization: Bearer $KEY"
POST/v1/functions/{name}/repo/builds

Build a branch of the linked repository now#

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

پارامترها

  • namestringمسیرالزامی

    the function's or app's name

    pattern ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ · up to 63 characters

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

  • branchstring

    default: the production branch

پاسخ

201objectCreated

  • buildstring
  • branchstring
  • commitstring
  • productionboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404not_linked, no_branch
409not_built
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/functions/my-api/repo/builds" \
  -H "Authorization: Bearer $KEY" \
  -d '{"branch":"dev"}'
POST/v1/repos/webhooks/github

Webhook from GitHub#

Called by GitHub; verified by X-Hub-Signature-256 (HMAC-SHA256 of the raw body). Roles: none (signature).

دسترسی
بدون اعتبارنامه

پارامترها

  • X-Hub-Signature-256stringheaderالزامی

    sha256=<hex>

  • X-GitHub-Eventstringheaderالزامی

    the event type

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

object

پاسخ

202objectAccepted

  • okboolean
  • resultstring

خطاها

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

نمونه

curl -X POST "https://api.ibel.ai/v1/repos/webhooks/github" \
  -d '{}'
POST/v1/repos/webhooks/gitlab/{link}

Webhook from GitLab#

Called by GitLab; verified by X-Gitlab-Token, one secret per linked project. Roles: none (token).

دسترسی
بدون اعتبارنامه

پارامترها

  • linkstring (uuid)مسیرالزامی
  • X-Gitlab-Tokenstringheaderالزامی

    the project's hook secret

  • X-Gitlab-Eventstringheaderالزامی

    Push Hook or Merge Request Hook

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

object

پاسخ

202objectAccepted

  • okboolean
  • resultstring

خطاها

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

نمونه

curl -X POST "https://api.ibel.ai/v1/repos/webhooks/gitlab/link" \
  -d '{}'
GET/v1/repos/callback/github

Return from Github's approval page#

Connects nothing itself: redirects to the dashboard's Settings → Git with a one-time finish=<ticket> (finished there with the person's session, POST /v1/repos/connections/finish) or error=<code>. Roles: none (signed state).

دسترسی
بدون اعتبارنامه

پاسخ

302Redirect to the dashboard

خطاها

وضعیتتوضیح
500internal: an unexpected failure

نمونه

درخواست
curl "https://api.ibel.ai/v1/repos/callback/github"
GET/v1/repos/callback/gitlab

Return from Gitlab's approval page#

Connects nothing itself: redirects to the dashboard's Settings → Git with a one-time finish=<ticket> (finished there with the person's session, POST /v1/repos/connections/finish) or error=<code>. Roles: none (signed state).

دسترسی
بدون اعتبارنامه

پاسخ

302Redirect to the dashboard

خطاها

وضعیتتوضیح
500internal: an unexpected failure

نمونه

درخواست
curl "https://api.ibel.ai/v1/repos/callback/gitlab"