API¶
spkrepo exposes a RESTful API and returns standard HTTP Status Codes in all responses. Data is returned as JSON.
Authentication¶
To access the API, user must be registered, have the developer
role and generated an API key from the profile
page. The Authorization header is mandatory and must contain the API key as user with no password.
If the authentication fails, a 401 Unauthorized is returned.
Warning
For security reasons, only one API key can be valid at a time. Should the API key be compromised, a new one can be generated from the profile page.
Errors¶
In case of ambiguous error, a detailed explaination is returned in JSON as message
HTTP/1.1 422 UNPROCESSABLE ENTITY
Content-Length: 43
Content-Type: application/json
{
"message": "Unknown architecture: myarch"
}
Endpoints¶
-
POST
/api/packages
¶ Post a SPK to the repository.
First a
Package
is created if not existing already, based on thename
. Only users withpackage_admin
role can create new packages, other users must be defined asmaintainers
to be able to continue.Then a
Version
is created with its appropriate relationships if not existing already, based on thepackage
and theversion
.Lastly, a
Build
is created with its appropriate relationships and files saved on the filesystem.Example response:
HTTP/1.1 201 CREATED Content-Length: 97 { "architectures": ["88f628x"], "firmware": "3.1-1594", "package": "btsync", "version": "1.4.103-10" }
Status Codes: - 201 Created – SPK registered
- 400 Bad Request – Request contained no body
- 403 Forbidden – Insufficient permission
- 409 Conflict – A
Build
already exists - 422 Unprocessable Entity – Invalid or malformed SPK
- 500 Internal Server Error – Signing or filesystem issue