This end-point provides access to Variants. Each variant is uniquely identified by release ID and variant UID. The pair in the form release_id/variant_uid is used in URL for retrieving, updating or deleting a single variant as well as in bulk operations.

Documents & examples

Method: GET

URL: /rest_api/v1/release-variants/

Query params:

  • allowed_push_targets (string)
  • id (string)
  • name (string)
  • release (string)
  • type (string)
  • uid (string)
  • variant_release (string)
  • variant_version (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

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "string"
}

Method: GET

URL: /rest_api/v1/release-variants/{release_id}/{variant_uid}/

Response:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "string"
}

Method: POST

URL: /rest_api/v1/release-variants/

Data:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "string"
}

The required architectures must already be present in PDC.

Field allowed_push_targets must be subset of parent release.

type: /rest_api/v1/release-variant-types/

Response:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "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.

Method: PUT

URL: /rest_api/v1/release-variants/{release_id}/{variant_uid}/

Data:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "string"
}

All attributes are required. The specified architectures will be set for this release. Also note that if you change the uid, the url for this variant will change.

Changing the architectures may involve deleting some. Note that repositories are connected to some Variant.Arch pair and it is not possible to remove an arch with any repositories..

Field allowed_push_targets must be subset of parent release.

type: /rest_api/v1/release-variant-types/

Response:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "string"
}

This call will delete selected variant with all its arches. Please note that if there are any repositories filed under this variant, you will get an error 409 CONFLICT.

Method: DELETE

URL: /rest_api/v1/release-variants/{release_id}/{variant_uid}/

It is possible to delete multiple items in one request. Use the DELETE method with the same url as for listing/creating objects. The request body should contain a list with identifiers for objects to be deleted. The identifier is usually the last part of the URL for deleting a single object.

Method: PATCH

URL: /rest_api/v1/release-variants/{release_id}/{variant_uid}/

Data:

{
    "release": string,
    "id": string,
    "uid": string,
    "name": string,
    "type": string,
    "arches": [string],
    "add_arches": [string],
    "remove_arches": [string]
}

All attributes are optional. If an attribute is not specified, that property of a variant will not change. The arches key can be used to set architectures associated with the variant. The add_arches key can list architectures to be added to current ones, with remove_arches some can be removed. While it is possible to combine add_arches with remove_arches, the arches attribute must not be combined with any other arch manipulation.

If you try to remove architectures with associated repositories, the request will fail to do anything.

Field allowed_push_targets must be subset of parent release.

Response:

{
    "allowed_push_targets (optional, default=[])": [
        "name"
    ], 
    "arches": [
        "string"
    ], 
    "id": "string", 
    "name": "string", 
    "release": "Release.release_id", 
    "type": "VariantType.name", 
    "uid": "string", 
    "variant_release (optional, default=null, nullable)": "string", 
    "variant_version (optional, default=null, nullable)": "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/release-variants/
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Last-Modified: Mon, 10 Dec 2018 09:35:41 GMT
Vary: Accept

{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}