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

{
    "count": 395839,
    "next": "https://pdc.fedoraproject.org/rest_api/v1/component-branches/?page=2",
    "previous": null,
    "results": [
        {
            "id": 44,
            "global_component": "0ad",
            "name": "epel7",
            "slas": [
                {
                    "id": 90,
                    "sla": "stable_api",
                    "eol": "2024-06-30"
                },
                {
                    "id": 89,
                    "sla": "security_fixes",
                    "eol": "2024-06-30"
                },
                {
                    "id": 88,
                    "sla": "bug_fixes",
                    "eol": "2024-06-30"
                }
            ],
            "type": "rpm",
            "active": true,
            "critical_path": false
        },
        {
            "id": 39,
            "global_component": "0ad",
            "name": "f16",
            "slas": [
                {
                    "id": 79,
                    "sla": "security_fixes",
                    "eol": "2013-02-12"
                },
                {
                    "id": 78,
                    "sla": "bug_fixes",
                    "eol": "2013-02-12"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 40,
            "global_component": "0ad",
            "name": "f17",
            "slas": [
                {
                    "id": 81,
                    "sla": "security_fixes",
                    "eol": "2013-07-30"
                },
                {
                    "id": 80,
                    "sla": "bug_fixes",
                    "eol": "2013-07-30"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 41,
            "global_component": "0ad",
            "name": "f18",
            "slas": [
                {
                    "id": 83,
                    "sla": "security_fixes",
                    "eol": "2014-01-14"
                },
                {
                    "id": 82,
                    "sla": "bug_fixes",
                    "eol": "2014-01-14"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 42,
            "global_component": "0ad",
            "name": "f19",
            "slas": [
                {
                    "id": 85,
                    "sla": "security_fixes",
                    "eol": "2015-01-06"
                },
                {
                    "id": 84,
                    "sla": "bug_fixes",
                    "eol": "2015-01-06"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 43,
            "global_component": "0ad",
            "name": "f20",
            "slas": [
                {
                    "id": 87,
                    "sla": "security_fixes",
                    "eol": "2015-06-23"
                },
                {
                    "id": 86,
                    "sla": "bug_fixes",
                    "eol": "2015-06-23"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 45,
            "global_component": "0ad",
            "name": "f21",
            "slas": [
                {
                    "id": 92,
                    "sla": "security_fixes",
                    "eol": "2015-12-01"
                },
                {
                    "id": 91,
                    "sla": "bug_fixes",
                    "eol": "2015-12-01"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 46,
            "global_component": "0ad",
            "name": "f22",
            "slas": [
                {
                    "id": 94,
                    "sla": "security_fixes",
                    "eol": "2016-07-19"
                },
                {
                    "id": 93,
                    "sla": "bug_fixes",
                    "eol": "2016-07-19"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 47,
            "global_component": "0ad",
            "name": "f23",
            "slas": [
                {
                    "id": 96,
                    "sla": "security_fixes",
                    "eol": "2016-12-20"
                },
                {
                    "id": 95,
                    "sla": "bug_fixes",
                    "eol": "2016-12-20"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 48,
            "global_component": "0ad",
            "name": "f24",
            "slas": [
                {
                    "id": 98,
                    "sla": "security_fixes",
                    "eol": "2017-08-11"
                },
                {
                    "id": 97,
                    "sla": "bug_fixes",
                    "eol": "2017-08-11"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 49,
            "global_component": "0ad",
            "name": "f25",
            "slas": [
                {
                    "id": 100,
                    "sla": "security_fixes",
                    "eol": "2017-12-12"
                },
                {
                    "id": 99,
                    "sla": "bug_fixes",
                    "eol": "2017-12-12"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 50,
            "global_component": "0ad",
            "name": "f26",
            "slas": [
                {
                    "id": 102,
                    "sla": "security_fixes",
                    "eol": "2018-05-29"
                },
                {
                    "id": 101,
                    "sla": "bug_fixes",
                    "eol": "2018-05-29"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 324199,
            "global_component": "0ad",
            "name": "f27",
            "slas": [
                {
                    "id": 648286,
                    "sla": "bug_fixes",
                    "eol": "2018-11-30"
                },
                {
                    "id": 648285,
                    "sla": "security_fixes",
                    "eol": "2018-11-30"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 348114,
            "global_component": "0ad",
            "name": "f28",
            "slas": [
                {
                    "id": 694608,
                    "sla": "bug_fixes",
                    "eol": "2019-08-08"
                },
                {
                    "id": 694607,
                    "sla": "security_fixes",
                    "eol": "2019-08-08"
                }
            ],
            "type": "rpm",
            "active": true,
            "critical_path": false
        },
        {
            "id": 372254,
            "global_component": "0ad",
            "name": "f29",
            "slas": [
                {
                    "id": 741828,
                    "sla": "bug_fixes",
                    "eol": "2019-12-07"
                },
                {
                    "id": 741827,
                    "sla": "security_fixes",
                    "eol": "2019-12-07"
                }
            ],
            "type": "rpm",
            "active": true,
            "critical_path": false
        },
        {
            "id": 38,
            "global_component": "0ad",
            "name": "master",
            "slas": [
                {
                    "id": 77,
                    "sla": "rawhide",
                    "eol": "2222-01-01"
                }
            ],
            "type": "rpm",
            "active": true,
            "critical_path": false
        },
        {
            "id": 8,
            "global_component": "0ad-data",
            "name": "epel7",
            "slas": [
                {
                    "id": 15,
                    "sla": "stable_api",
                    "eol": "2024-06-30"
                },
                {
                    "id": 14,
                    "sla": "security_fixes",
                    "eol": "2024-06-30"
                },
                {
                    "id": 13,
                    "sla": "bug_fixes",
                    "eol": "2024-06-30"
                }
            ],
            "type": "rpm",
            "active": true,
            "critical_path": false
        },
        {
            "id": 3,
            "global_component": "0ad-data",
            "name": "f16",
            "slas": [
                {
                    "id": 4,
                    "sla": "security_fixes",
                    "eol": "2013-02-12"
                },
                {
                    "id": 3,
                    "sla": "bug_fixes",
                    "eol": "2013-02-12"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 4,
            "global_component": "0ad-data",
            "name": "f17",
            "slas": [
                {
                    "id": 6,
                    "sla": "security_fixes",
                    "eol": "2013-07-30"
                },
                {
                    "id": 5,
                    "sla": "bug_fixes",
                    "eol": "2013-07-30"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        },
        {
            "id": 5,
            "global_component": "0ad-data",
            "name": "f18",
            "slas": [
                {
                    "id": 8,
                    "sla": "security_fixes",
                    "eol": "2014-01-14"
                },
                {
                    "id": 7,
                    "sla": "bug_fixes",
                    "eol": "2014-01-14"
                }
            ],
            "type": "rpm",
            "active": false,
            "critical_path": false
        }
    ]
}