Vendor API
Access to the vendor API of the application server, the main requests, publishing a version through git and the release request.
The vendor API is the /v1/vendor/* requests of the application server apps.tozade.ru. The application server has no vendor accounts; access is by token. The answer is JSON: the data field on success, the error field with code and message on failure. The request rate is limited: when it is exceeded the answer is RATE_LIMITED with retry_after.
Access
- The client address must be in the vendor
allow_ips. Otherwise the answer isIP_NOT_ALLOWED. An empty list switches the API off for the vendor. - The header
Authorization: Bearer <token>. The token is issued in the developer account on the site and shown once; the server stores only its SHA-256. - The vendor must be active, otherwise
VENDOR_BLOCKED.
Requests
| Request | What it does |
|---|---|
GET /v1/vendor | The vendor profile. |
GET /v1/vendor/keys | The vendor keys, their bindings and the replacement log. |
POST /v1/vendor/keys | Register a key: fields algorithm, public_key, replaces, see release signature. |
GET /v1/vendor/apps | The vendor applications; optional filter product. |
POST /v1/vendor/apps | Create an application in your namespace: fields product and code. A current vendor key is required. |
PATCH /v1/vendor/apps/{code} | Show the application in the catalog or hide it: status is listed or unlisted. |
POST /v1/vendor/apps/{code}/release-requests | A release request: field version, a version tagged on the test branch. |
GET /v1/vendor/apps/{code}/release-requests | The application requests; filter status: open, approved, rejected, withdrawn. |
GET /v1/vendor/apps/{code}/release-requests/{id} | A request: its state and the reason for rejection. |
POST /v1/vendor/apps/{code}/release-requests/{id}/withdraw | Withdraw an open request before the decision. |
GET /v1/vendor/apps/{code}/versions | The application versions and their states. |
GET /v1/vendor/apps/{code}/versions/{version} | A version: its state and transition history. |
PATCH /v1/vendor/apps/{code}/versions/{version} | max_product_version (narrowing only) and changelog per language ru and en (markdown). |
POST /v1/vendor/apps/{code}/versions/{version}/unpublish | Unpublish a version; the field reason is required. |
POST /v1/vendor/apps/{code}/versions/{version}/publish | Return an unpublished version; one unpublished by the administrator cannot be returned (UNPUBLISHED_BY_ADMIN). |
Publishing through git
An application is the git repository https://apps.tozade.ru/git/crm/<namespace>/<code>.git. Anyone can read it; pushing is over HTTPS only: the login is the namespace, the password is the vendor token (the same allow_ips, vendor status and rate limit as for the API). Creating the application with a request is optional: the first push registers it as a draft. Without a current vendor key the push is rejected (VENDOR_KEY_REQUIRED).
- Sign the version: raise
versioninmanifest.ymland runapp-hashes.sh, see release signature. - Commit together with
sig/and send only thetestbranch:git push origin test. The push is a fast-forward; tags, deletion, force push and a direct push toreleaseare rejected. - The server checks the whole push and sets the version tag itself from the manifest
version. The reason for a rejection is printed ingit push. - File a release request:
POST /v1/vendor/apps/{code}/release-requestswith the fieldversion. - The moderator approves the request: the server moves the version to
releaseand publishes it in the catalog. After a rejection fix the application and release a new version with a greater number.
Versions
- The number is
MAJOR.MINOR.PATCH, each number at most 9 digits, no pre-releases. - On
testa version is strictly greater than all earlier tags: an equal or lower one is rejected. Every push totestis a new version. - In a request the version is strictly greater than the version in
release, otherwiseVERSION_OLDER. - Versions are immutable: a number is never reused, a fix comes out under a new, greater number.
Release request
testis the working branch and does not reach the catalog.releaseholds what is released: only the moderator moves a version into it, on a request.- Request states:
open, thenapprovedorrejected(the moderator decides) orwithdrawn(withdrawn by the vendor before the decision). - Checks on a request: the version tag is on a commit of the
testbranch, the hash list and signature are valid,releaseis an ancestor of the commit,min_product_versionis in the list of product versions, there is no other open request for the version, the application is not blocked. - The moderator works through
/v1/moderation/release-requests(tokenapm_…): the list, viewing the hash list and changed files,approveandrejectwith a required reason. These requests are not available to the vendor.
Request errors
| Code | When |
|---|---|
PACKAGE_INVALID | The hash list, the fingerprint or the contents of sig/, or the version contents (manifest, locales, types, icon) failed the check; the reason is in message. |
RELEASE_SIGNATURE_INVALID | The hash list signature does not match the current vendor key. |
KEY_RETIRED | The vendor key was replaced between the check of the request and its approval; the request will be checked again. |
VERSION_OLDER | The request version is not greater than the version in release. |
VERSION_EXISTS | The number is already in release, in the catalog under another commit, or has an open request. |
VERSION_STATE_INVALID | The version is not from the test branch, release is not an ancestor of its commit, the tag is on another commit, or the version state transition is not allowed. |
PRODUCT_VERSION_UNKNOWN | min_product_version or max_product_version is not in the list of product versions. |
VENDOR_KEY_REQUIRED | The vendor has no current key: register a key first. |
APP_BLOCKED_BY_ADMIN | The application or version is blocked by the administrator. |