Overview

This page shows the usage of the SigKey API, please see the following for more details.

Test tools

You can use curl in terminal, with -X method (GET|POST|PUT|PATCH|DELETE), -d data (a json string). or GUI plugins for browsers, such as RESTClient, RESTConsole.

Documents & examples

LIST

Method: GET

URL: /rest_api/v1/sigkeys/

Query Params:

  • description (string, case insensitive, substring match)
  • key_id (string)
  • name (string)
  • ordering (string) Comma separated list of fields for ordering results.
    • To sort by a field in descending order, prefix its name with minus (e.g. -name).
    • Use double underscores for nested field names (e.g. parent__child for {"parent": {"child": ...}}).

Following filters can be used to show only specific fields. This can make response time faster. Format is list or single value (JSON: {"fields": ["a","b"]} or {"fields": "a"}, in URL: ?fields=a&fields=b).

  • fields (list | string) Fields to display (other fields will be hidden).
  • exclude_fields: (list | string) Fields NOT to display (overrules fields).

Response: a paged list of following objects

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

RETRIEVE

Method: GET

URL: /rest_api/v1/sigkeys/{key_id}/

Response:

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

CREATE

Method: POST

URL: /rest_api/v1/sigkeys/

Data:

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

Response:

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

It is possible to create this resource in bulk. To do so, use the same procedure as when creating a single instance, only the request body should contain a list of JSON objects. The response you get back will also contain a list of values which you would obtain by submitting the request data separately.

UPDATE

When using the PUT method, if an optional field is not specified in the input, it will be erased.

Method: PUT, PATCH

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

All keys are optional for PATCH request, but at least one must be specified.

URL: /rest_api/v1/sigkeys/{key_id}/

Response:

{
    "description (optional, default=\"\")": "string", 
    "key_id": "string", 
    "name (optional, default=null)": "string"
}

It is possible to update multiple objects in one request. Use the PUT or PATCH method with the same url as for listing/creating objects. The request body should contain an object, where keys are identifiers of objects to be modified and their values use the same format as normal update.

Browsable GET

GET /rest_api/v1/sigkeys/
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 10,
    "next": null,
    "previous": null,
    "results": [
        {
            "name": null,
            "key_id": "81b46521",
            "description": ""
        },
        {
            "name": null,
            "key_id": "fdb19c98",
            "description": ""
        },
        {
            "name": null,
            "key_id": "e372e838",
            "description": ""
        },
        {
            "name": null,
            "key_id": "64dab85d",
            "description": ""
        },
        {
            "name": null,
            "key_id": "f5282ee4",
            "description": ""
        },
        {
            "name": null,
            "key_id": "a3cc4e62",
            "description": ""
        },
        {
            "name": null,
            "key_id": "9db62fb1",
            "description": ""
        },
        {
            "name": "name2",
            "key_id": "bbbbbbbb",
            "description": "descr2"
        },
        {
            "name": null,
            "key_id": "429476b4",
            "description": ""
        },
        {
            "name": null,
            "key_id": "cfc659b9",
            "description": ""
        }
    ]
}