Overview

This page shows the usage of the Bugzilla Component API, please see the following for more details. Bugzilla Component includes what products and components have sub components. It also can be tracked in Release Component API.

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/bugzilla-components/

Query Params:

  • name (string)
  • parent_component (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

{
    "id (read-only)": "int", 
    "name": "string", 
    "parent_component (optional, default=null)": "string", 
    "subcomponents (read-only)": "[string]"
}

Method: GET

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

Response:

{
    "id (read-only)": "int", 
    "name": "string", 
    "parent_component (optional, default=null)": "string", 
    "subcomponents (read-only)": "[string]"
}

Method: POST

URL: /rest_api/v1/bugzilla-components/

Data:

{
    "name":                        "string",         # required
    "parent_pk: (default=None)":   "int"             # optional
}

Response:

{
    "id (read-only)": "int", 
    "name": "string", 
    "parent_component (optional, default=null)": "string", 
    "subcomponents (read-only)": "[string]"
}

NOTE:

Root bugzilla component will be created if parent_pk is not given or {"parent_pk": 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.

Method: PUT, PATCH

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

Data:

{
    "name":                        "string",
    "parent_pk":                   "int"
}

Response:

{
    "id (read-only)": "int", 
    "name": "string", 
    "parent_component (optional, default=null)": "string", 
    "subcomponents (read-only)": "[string]"
}

NOTE:

For PATCH, {"parent_pk": null} is to set parent_pk to null, while parent_pk not given means not update parent_pk

Method: DELETE

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

Response:

STATUS: 204 NO CONTENT

NOTE:

Descendants will be deleted as well.

Example:

curl -X DELETE -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/bugzilla-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/bugzilla-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": []
}