Global Component List
Overview
This page shows the usage of the Global 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/global-components/
Query Params:
dist_git_path
(string)label
(string)name
(string)upstream_homepage
(string)upstream_scm_type
(string)upstream_scm_url
(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": ...}}
).
- To sort by a field in descending order, prefix its name with minus (e.g.
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 (overrulesfields
).
Response:
# paged lists
{
"count": int,
"next": url,
"previous": url,
"results": [
{
"id": int,
"name": string,
"dist_git_path": <string|null>,
"dist_git_web_url": string,
"labels": [
string, ......
],
"upstream": null | {
"homepage": string,
"scm_type": string,
"scm_url": string
}
},
...
}
Method: GET
URL: /rest_api/v1/global-components/{instance_pk}/
Response:
{
"id": int,
"name": string,
"dist_git_path": <string|null>,
"dist_git_web_url": string,
"labels": [
string, ......
],
"upstream": null | {
"homepage": string,
"scm_type": string,
"scm_url": string
}
}
Method: POST
URL: /rest_api/v1/global-components/
Data:
{
'name': string, # required
'dist_git_path': string, # optional
'upstream': dict, # optional
}
Response:
{
"id": int,
"name": string,
"dist_git_path": string,
"dist_git_web_url": string,
"labels": array,
"upstream": dict
}
Example:
curl -X POST -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/global-components/ \
-d '{ "name": "Demo", "dist_git_path": "rpm/Demo"}'
# output
{
"id": 4181,
"name": "Demo",
"dist_git_path": "rpm/Demo",
"dist_git_web_url": "http://pkgs.example.com/cgit/rpms/rpm/Demo"
"labels": [],
"upstream": null | {
"homepage": string,
"scm_type": string,
"scm_url": 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/PATCH: for update
Data:
# accept any field(s) from 'name', 'dist_git_path' and 'upstream'
{'name': 'new_name',
'dist_git_path': 'new_dist_git_path',
'upstream': {'homepage': 'homepage',
'scm_type': 'scm-type',
'scm_url': 'url'}
}
URL: /rest_api/v1/global-components/{instance_pk}/
Response:
{
"id": int,
"name": string,
"dist_git_path": string,
"dist_git_web_url": string,
"labels": array,
"upstream": null | {
"homepage": string,
"scm_type": string,
"scm_url": string
}
}
Example:
PUT:
curl -X PUT -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/global-components/4181/ \
-d '{"name": "Demo1", "dist_git_path": "rpm/Demo1"}'
# output
{
"id": 4181,
"name": "Demo",
"dist_git_path": "rpm/Demo1",
"dist_git_web_url": "http://pkgs.example.com/cgit/rpms/rpm/Demo1"
"labels": [],
"upstream": null
}
PATCH:
curl -X PATCH -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/global-components/4181/ -d '{"dist_git_path": "rpm/Demo1"}'
# output
{
"id": 4181,
"name": "Demo",
"dist_git_path": "rpm/Demo1",
"dist_git_web_url": "http://pkgs.example.com/cgit/rpms/rpm/Demo1"
"labels": [],
"upstream": null
}
Method: DELETE
URL: /rest_api/v1/global-components/{instance_pk}/
Response:
STATUS: 204 NO CONTENT
Example:
curl -X DELETE -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/global-components/4181/
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/global-components/?page=1894
https://pdc.fedoraproject.org/rest_api/v1/global-components/?page=1895", "previous": "https://pdc.fedoraproject.org/rest_api/v1/global-components/?page=1893", "results": [ { "id": 99475, "name": "golang-github-r3labs-diff-3", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/golang-github-r3labs-diff-3.git", "labels": [], "upstream": null }, { "id": 99476, "name": "kf6-kdnssd", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-kdnssd.git", "labels": [], "upstream": null }, { "id": 99477, "name": "kf6-kitemviews", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-kitemviews.git", "labels": [], "upstream": null }, { "id": 99478, "name": "rust-gix-pack", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/rust-gix-pack.git", "labels": [], "upstream": null }, { "id": 99479, "name": "rust-gix-protocol", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/rust-gix-protocol.git", "labels": [], "upstream": null }, { "id": 99480, "name": "rust-gix-submodule", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/rust-gix-submodule.git", "labels": [], "upstream": null }, { "id": 99481, "name": "speedtest", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/speedtest.git", "labels": [], "upstream": null }, { "id": 99482, "name": "python-pyxdameraulevenshtein", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/python-pyxdameraulevenshtein.git", "labels": [], "upstream": null }, { "id": 99483, "name": "jstest-gtk", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/jstest-gtk.git", "labels": [], "upstream": null }, { "id": 99484, "name": "qt6-qthttpserver", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/qt6-qthttpserver.git", "labels": [], "upstream": null }, { "id": 99485, "name": "snapshot", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/snapshot.git", "labels": [], "upstream": null }, { "id": 99486, "name": "kf6-kcodecs", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-kcodecs.git", "labels": [], "upstream": null }, { "id": 99487, "name": "kf6-kitemmodels", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-kitemmodels.git", "labels": [], "upstream": null }, { "id": 99488, "name": "pthreadpool", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/pthreadpool.git", "labels": [], "upstream": null }, { "id": 99489, "name": "python-annotated-types", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/python-annotated-types.git", "labels": [], "upstream": null }, { "id": 99490, "name": "kf6-kcalendarcore", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-kcalendarcore.git", "labels": [], "upstream": null }, { "id": 99491, "name": "kf6-prison", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/kf6-prison.git", "labels": [], "upstream": null }, { "id": 99492, "name": "python-pyvhacd", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/python-pyvhacd.git", "labels": [], "upstream": null }, { "id": 99493, "name": "rust-gix-worktree-state", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/rust-gix-worktree-state.git", "labels": [], "upstream": null }, { "id": 99494, "name": "rust-gix-odb", "dist_git_path": null, "dist_git_web_url": "https://src.fedoraproject.org/cgit/rpms/rust-gix-odb.git", "labels": [], "upstream": null } ] }{ "count": 38304, "next": "