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 the name. Only users with package_admin role can create new packages, other users must be defined as maintainers to be able to continue.

Then a Version is created with its appropriate relationships if not existing already, based on the package and the version.

Lastly, a Build is created with its appropriate relationships and files saved on the filesystem.

Note

The created Build is not active by default

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: