Warning: This is an experimental API

Overview

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

Please note that the following restrictions are applied to the branch name during creation: none

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/component-branches/

Query Params:

  • active (bool)
  • critical_path (bool)
  • global_component (string)
  • name (string)
  • 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).

Response:

{
    "count": int,
    "next": url,
    "previous": url,
    "results": [
        {
            "id": int,
            "global_component": string,
            "name": string,
            "slas": list,
            "type": string,
            "active": boolean,
            "critical_path": boolean
        }
        ...
    ]
}

Method: GET

URL: /rest_api/v1/component-branches/{id}/

Response:

{
    "id": int,
    "global_component": string,
    "name": string,
    "slas": list,
    "type": string,
    "active": boolean,
    "critical_path": boolean
}

Method: POST

URL: /rest_api/v1/component-branches/

Parameters:

  • name: the name of the branch
  • global_component: the name of the global component this branch belongs to
  • type: the name of the branch's type (ReleaseComponentType)
  • critical_path: a boolean determining if the branch is "critical path". This defaults to false.

Data:

{
    "global_component": string,
    "name": string,
    "type": string,
    "critical_path": boolean
}

Response:

{
    "active (read-only)": "\n        Calls the is_branch_active function to determine if the branch is still\n        active\n        :param branch: a ComponentBranch object\n        :return: a boolean\n        ", 
    "critical_path (optional, default=false)": "boolean", 
    "global_component": "GlobalComponent.name", 
    "id (read-only)": "int", 
    "name": "UNKNOWN", 
    "slas (read-only)": [
        {
            "eol (read-only)": "date", 
            "id (read-only)": "int", 
            "sla (read-only)": "name"
        }
    ], 
    "type": "ReleaseComponentType.name"
}

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/PATCH: for update

Parameters:

  • name: the name of the branch. This value is not modifiable.
  • global_component: the name of the global component this branch belongs to
  • type: the name of the branch's type (ReleaseComponentType)
  • critical_path: a boolean determining if the branch is "critical path". This defaults to false.

Data:

{
    "global_component": string,
    "name": string,
    "type": string,
}

URL: /rest_api/v1/component-branches/{id}/

Response:

{
    "id": int,
    "global_component": string,
    "name": string,
    "slas": list,
    "type": string,
    "active": boolean,
    "critical_path": boolean
}

Example:

PUT:

curl -X PUT -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/component-branches/1/ \
        -d '{"name": "2.7", "global_component": "python", "type": "rpm"}'
# Output
{
    "id": 1,
    "global_component": "python",
    "name": "2.7",
    "slas": [],
    "type": "rpm",
    "active": true,
    "critical_path": false
}

PATCH:

curl -X PATCH -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/component-branches/1/ -d '{"type": "container"}'
# Output
{
    "id": 1,
    "global_component": "python",
    "name": "2.7",
    "slas": [],
    "type": "rpm",
    "active": false,
    "critical_path": false
}

Method: DELETE

URL: /rest_api/v1/component-branches/{id}/

Response:

STATUS: 204 NO CONTENT

Example:

curl -X DELETE -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/component-branches/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/component-branches/?global_component=minetest&type=module
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 418496,
            "global_component": "minetest",
            "name": "5",
            "slas": [
                {
                    "id": 833488,
                    "sla": "rawhide",
                    "eol": "2020-09-15"
                }
            ],
            "type": "module",
            "active": false,
            "critical_path": false
        },
        {
            "id": 418495,
            "global_component": "minetest",
            "name": "master",
            "slas": [
                {
                    "id": 833487,
                    "sla": "rawhide",
                    "eol": "2019-03-08"
                }
            ],
            "type": "module",
            "active": false,
            "critical_path": false
        }
    ]
}