KabaForge
🌍 Türkçe · English · Deutsch · Français · Русский

16 — Working with the API

Almost anything you can do in the interface can be done over HTTP too: backups, reporting, your own tools.

Authentication

Create an access token (chapter 10) and send it as a header on every request:

TOKEN=your-token
curl -H "Authorization: token $TOKEN" \
  https://forge.kabaforce.com/api/v1/user

A token is limited to the permissions you picked when creating it: do not grant write access for a read-only job.

Endpoints you will use most

Base address: https://forge.kabaforce.com/api/v1

EndpointWhat it returns
/userThe account owning the token
/user/repos?limit=50Repositories you can reach
/repos/search?q=wordRepository search
/repos/{owner}/{repo}Repository metadata
/repos/{owner}/{repo}/contents/{path}File or folder contents
/repos/{owner}/{repo}/branchesBranches
/repos/{owner}/{repo}/commits?limit=10Recent commits
/repos/{owner}/{repo}/issues?state=openOpen issues
/repos/{owner}/{repo}/releases · /tagsReleases and tags

Lists are paginated: ?page=2&limit=50.

Reading a file

curl -H "Authorization: token $TOKEN" \
  "https://forge.kabaforce.com/api/v1/repos/owner/project/contents/docs"

The content field comes back base64-encoded; asking for the raw file is usually simpler:

curl -H "Authorization: token $TOKEN" \
  https://forge.kabaforce.com/owner/project/raw/branch/main/readme.md

Creating and updating files

curl -X POST -H "Authorization: token $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content":"aGVsbG8=","message":"add note","branch":"main"}' \
  https://forge.kabaforce.com/api/v1/repos/owner/project/contents/notes.md

content is base64. To update an existing file use PUT and send the file's current sha — that is what stops you from silently overwriting someone else's change.

Opening an issue

curl -X POST -H "Authorization: token $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title":"login page shifts on mobile","body":"Steps: ..."}' \
  https://forge.kabaforce.com/api/v1/repos/owner/project/issues

Error codes

CodeMeaning
401No token, wrong token, or expired
403Valid token without permission for this action
404Wrong path — or a private repository you cannot see
409Conflict: you sent a stale sha on update
422Malformed body (an issue without a title, for example)

Rules

⬅ Previous: 15 — Shortcuts and address tricks📚 All chaptersNext: 17 — Advanced Markdown ➡