SPB Git

Repository Public

API_INVENTORY.md 6.6 KB 94 lines markdown

1# API inventory23Every HTTP route of SPB Git that matters to the iOS client, read from the server code (`src/server.mjs`,4`src/api/v1.mjs`, `src/web/routes.mjs`, `src/git/smart-http.mjs`) at version 3.2.0, then the routes added in 3.3.0.5The precise shapes of the 3.3.0 routes are in [`API_CONTRACT.md`](API_CONTRACT.md); the machine-readable6description is `GET /api/v1/openapi.json` once 3.3.0 is deployed.78Legend for "Shield": `open`/`api` are never refused by the shield (the general limit of 200 requests per minute9per address still applies); `deep` goes through the visitor-pass and global budgets.1011## 1. Present in 3.2.01213### Public reads1415| Method and path | Parameters | Response | Shield | Used by the app |16|---|---|---|---|---|17| `GET /healthz` | | status, version, repository count, cache, memory, git semaphore, shield mode, features | open | capability fallback, admin |18| `GET /api/v1/repos` | | `{repos: [Overview]}` | api | repository list, dashboard, collections |19| `GET /api/v1/repos/:name` | | `Overview` | api | repository detail |20| `GET /api/v1/repos/:name/languages` | | `{languages, totalBytes}` | api | detail |21| `GET /api/v1/repos/:name/commits` | `ref`, `page` | 30 commits per page, `hasNext` | deep | commit list |22| `GET /api/v1/repos/:name/tree` | `ref`, `path` | entries `{name, path, type, size}` | deep (weight 0.25) | file explorer |23| `GET /api/v1/repos/:name/releases` | | tags with assets | api | releases |24| `GET /api/v1/stats` | | totals, streaks, active days | api | dashboard |25| `GET /api/v1/search` | `q` (120 chars), `scope`, `repo`, `limit` (max 50) | grouped results | deep | search |26| `GET /api/v1/ai/status` | | AI feature status (disabled in production) | api | not used in 1.0 |27| `GET /raw/:repo/<ref>/<path>` | | bytes, `text/plain` for text, sandboxing CSP | deep, or `embed` for branch images | file viewers, images |28| `GET /archive/:repo/<ref>.zip` or `.tar.gz` | | archive | archive (6 per minute per address) | explicit download only |29| `GET /releases/:repo/:tag/:asset` | | asset bytes | release | release downloads |30| `GET /feed.atom` | | Atom feed of recent pushes | open | superseded by `/api/v1/activity` |31| `GET /badge/:repo/:metric.svg` | | SVG badge | open | not used |32| `GET /pass/challenge` | | `{challenge, bits, expiresIn}` | pass | visitor pass |33| `POST /pass/redeem` | `{challenge, nonce}` | `204` and cookies | pass | visitor pass |3435HTML pages (`/`, `/:repo`, `/:repo/tree/*`, `/:repo/blob/*`, `/:repo/commits/*`, `/:repo/commit/:sha`,36`/:repo/blame/*`, `/:repo/branches`, `/:repo/tags`, `/:repo/releases`, `/:repo/insights`, `/:repo/research`,37`/search`, `/about/metrics`, `/about/api`) are not consumed by the application. Their URL shapes are the ones the38application accepts as Universal Links and produces when sharing.3940### Authenticated (personal access token, `Authorization: Bearer` or HTTP Basic)4142| Method and path | Body | Effect |43|---|---|---|44| `GET /api/v1/whoami` | | owner name, token label and id |45| `POST /api/v1/repos` | `name, description, topics, homepage, pinned, defaultBranch` | creates a bare repository and its hooks |46| `PATCH /api/v1/repos/:name` | `description, topics, homepage, pinned, research, defaultBranch` | updates metadata |47| `DELETE /api/v1/repos/:name` | | soft delete, recoverable for 30 days |48| `GET /api/v1/tokens`, `POST /api/v1/tokens`, `DELETE /api/v1/tokens/:id` | `label` | token management |49| `PUT /api/v1/repos/:name/releases/:tag/assets/:asset` | octet stream, up to 4 GiB | uploads an asset to an existing tag |50| `DELETE /api/v1/repos/:name/releases/:tag/assets/:asset` | | deletes an asset |51| `GET /api/v1/admin/shield`, `POST /api/v1/admin/shield` | `mode: on, off, auto` | shield counters and mode |52| `POST /api/v1/repos/:name/ask`, `POST /api/v1/repos/:name/commits/:sha/summary` | | AI routes, `404` while AI is disabled |5354### Git transport5556`GET /:repo(.git)/info/refs`, `POST /:repo(.git)/git-upload-pack` (public clone and fetch),57`POST /:repo(.git)/git-receive-pack` (push, token required). The application does not speak the Git protocol in581.0; see the local engine evaluation in [`IOS_ARCHITECTURE.md`](IOS_ARCHITECTURE.md).5960### Formats and conventions observed6162- Errors: `{"error": {"code", "message"}}`; codes seen: `not_found`, `ref_not_found`, `invalid_path`,63  `validation_failed`, `invalid_name`, `already_exists`, `unknown_branch`, `unauthorized`, `invalid_tag`,64  `invalid_asset`, `unknown_tag`, `no_body`, `upload_failed`, `ai_disabled`.65- Shield refusals are `text/plain` or HTML, not JSON, with `X-Spbgit-Shield`, `Retry-After`, status `403`, `429`66  or `503`.67- Compression: brotli and gzip above 1 KB. ETags exist only on the tree API and on HTML pages pinned to a commit.68- Dates: ISO 8601 with offset for git dates, UTC `Z` for server timestamps.69- Repository names: `^[a-z0-9][a-z0-9._-]{0,63}$`. Topics: `^[a-z0-9][a-z0-9-]{0,34}$`, 10 at most.70  Description: 350 characters at most.7172## 2. Missing in 3.2.0, added in 3.3.07374| Need of the application | Route added |75|---|---|76| Capabilities and limits | `GET /api/v1/meta`, `GET /api/v1/openapi.json` |77| Lighter and filterable list, collections | `GET /api/v1/repos?compact&q&language&topic&collection&sort&order&page&perPage`, `GET /api/v1/collections` |78| README source | `GET /api/v1/repos/:name/readme` |79| File metadata and content, paged for large files | `GET /api/v1/repos/:name/blob`, `GET /api/v1/repos/:name/blob/lines`, `Range` on `/raw` |80| Branches, tags | `GET /api/v1/repos/:name/branches`, `GET /api/v1/repos/:name/tags` |81| Filtered history | `commits?perPage&path&author&since&until&q`, `parents` on each commit |82| Commit detail, structured diff, comparison, graph | `GET …/commits/:sha`, `…/commits/:sha/diff`, `…/compare`, `…/graph` |83| Analytics | `GET /api/v1/metrics`, `GET /api/v1/repos/:name/metrics`, `GET /api/v1/metrics/compare` |84| Activity | `GET /api/v1/activity` |85| Code search, tags, suggestions | `GET /api/v1/search?scope=code|tags&lang&exact&suggest&regex&word&case&cursor` |86| Scoped, expiring tokens; audit | `scopes`, `expiresAt` on tokens; `GET /api/v1/admin/overview`, `GET /api/v1/admin/audit` |87| Commits from the editor | `POST /api/v1/repos/:name/commits` |88| Branch and tag management | `POST`/`DELETE …/branches`, `POST`/`DELETE …/tags` |89| Notifications | `POST /api/v1/devices`, `DELETE /api/v1/devices/:deviceToken` |90| Universal Links, store pages | `/.well-known/apple-app-site-association`, `/about/ios`, `/about/ios/privacy`, `/about/ios/support` |9192The application reads `GET /api/v1/meta` at launch. Against a server older than 3.3.0 (the route answers `404`)93it keeps working with the routes of section 1 and hides the features that need the new ones.94
Files main
Menu

Theme