Overview

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

Test tools

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

Documents & examples

Method: GET

URL: /rest_api/v1/release-components/

Query Params:

  • active (bool)
  • brew_package (string)
  • bugzilla_component (string)
  • dist_git_branch (string)
  • global_component (string)
  • include_inactive_release
  • name (string)
  • release (string)
  • srpm_name (string | null)
  • type (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).

Components for inactive releases are not shown by default. You can change this with include_inactive_release set to any non-empty value.

Response:

# paged lists
{
    "count": int,
    "next": url,
    "previous": url,
    "results": [
        {
            "id": int,
            "release": {
                "release_id": string,
                "active": bool
            },
            "global_component": string,
            "bugzilla_component": {
                "id": int,
                "name": string,
                "parent_component": string,
                "subcomponents": [
                    ......
                ]
            },
            "brew_package": string,
            "name": string,
            "dist_git_branch": <string|null>,
            "dist_git_web_url": string,
            "active": bool,
            "srpm": {
                "name": string
            } OR null,
            "type": <string|null>
        }
        ...
}

Method: GET

URL: /rest_api/v1/release-components/{instance_pk}/

Response:

{
    "id": int,
    "release": {
        "release_id": string,
        "active": bool
    },
    "global_component": string,
    "bugzilla_component": {
        "id": int,
        "name": string,
        "parent_component": string,
        "subcomponents": [
            ......
        ]
    },
    "brew_package": string,
    "name": string,
    "dist_git_branch": <string|null>,
    "dist_git_web_url": string,
    "active": true,
    "srpm": {
        "name": string
    } OR null,
    "type": <string|null>
}

Method: POST

URL: /rest_api/v1/release-components/

Data:

{
    'name':                          string,         # required
    'release':                       string,         # required
    'global_component':              string,         # required
    'dist_git_branch':               string,         # optional
    'bugzilla_component':            string,         # optional
    'brew_package':                  string,         # optional
    'active':                        bool,           # optional
    'srpm':
        {
            "name":                  string,
        } OR null,                                   # optional
    'type':                          string,         # optional
}

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

Response:

{
    "id": int,
    "release": {
        "release_id": string,
        "active": bool
    },
    "global_component": string,
    "brew_package": string,
    "name": string,
    "dist_git_branch": <string|null>,
    "dist_git_web_url": string,
    "active": true,
    "bugzilla_component": {
        "id": int,
        "name": string,
        "parent_component": null,
        "subcomponents": [
            ......
        ]
    },
    "srpm": {
        "name": string
    } OR null,
    "type": <string|null>
}

NOTE:

bugzilla_component can be in format parent_component/bugzilla_component or bugzilla_component, for example, kernel/filesystem or kernel, single bugzilla_component means parent_component is null.

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.

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

Method:

PUT:

name: new release component's name, REQUIRED

dist_git_branch: new release component dist git branch, OPTIONAL

bugzilla_component: bugzilla component name, OPTIONAL

brew_package: brew package name, OPTIONAL

"active": status of release component, defalut=true,OPTIONAL

"srpm": { "name": srpm name of release component } OR null, OPTIONAL

"type": release component type, OPTIONAL

"global_component": release component's global component, OPTIONAL

PATCH:

name: new release component's name, OPTIONAL

dist_git_branch: new release component dist git branch, OPTIONAL

bugzilla_component: bugzilla component name, OPTIONAL

brew_package: brew package name, OPTIONAL

"active": status of release component, OPTIONAL

"srpm": { "name": srpm name of release component } OR null, OPTIONAL

"type": release component type, OPTIONAL

"global_component": release component's global component, OPTIONAL

URL: /rest_api/v1/release-components/{instance_pk}/

Response:

{
    "id": int,
    "release": {
        "release_id": string,
        "active": bool
    },
    "global_component": string,
    "bugzilla_component": {
        ......
    },
    "brew_package": string,
    "name": string,
    "dist_git_branch": <string|null>,
    "dist_git_web_url": string,
    "active": true,
    "srpm": {
        "name": string
    } OR null
}

NOTE:

bugzilla_component can be in format parent_component/bugzilla_component or bugzilla_component, for example, kernel/filesystem or kernel, single bugzilla_component means parent_component is null. {"bugzilla_component": null or "bugzilla_component": ""} is to set bugzilla_component to null, while bugzilla_component not given means not update bugzilla_component.

Method: DELETE

URL: /rest_api/v1/release-components/{instance_pk}/

Response:

STATUS: 204 NO CONTENT

Example:

curl -X DELETE -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/release-components/1/

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.

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-components/
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

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