I am currently querying Bugzilla as follows:
r = requests.get(
"https://bugzilla.mozilla.org/rest/bug",
params={
"chfield": "[Bug creation]",
"chfieldfrom": "2015-01-01",
"chfieldto": "2016-01-01",
"resolution": "FIXED",
"limit": 200,
"api_key": api_key,
"include_fields": [
"id",
"description",
"creation_time",
],
},
)
and all I would like to add to my query is a method for ordering the bug reports. I have scoured the web for a method for ordering these results: ultimately, I would like them to be ordered from "2016-01-01" descending. I have tried adding the following key-value pairs to params:
"order": "creation_time desc""sort_by": "creation_time", "order" : "desc""chfieldorder": "desc"
and I've tried editing the URL to be https://bugzilla.mozilla.org/rest/bug?orderBy=creation_time:desc but none of these approaches have worked. Unfortunately, adding invalid keys fails without error: results are returned, just not in sorted order.
Ordering and ranges (ie., chfieldfrom and chfieldto) were not in any of the documentation that I found either.
I am aware that a hacked method of gathering ordered results would be to specify a narrow range of dates to get bug reports from, but I'm hoping there exists an actual key-value pair that can be specified to achieve the task.
Notably, of course: sorting after the request returns in r is invalid, because the results in r do not contain the most recent bugs.
You need to add
to your
params.Quick test
To see more easily that it works, just run something like this after you received the response in
r:gives:
Details
If you are interested in the details: It looks like some fields in the Bugzilla codebase have different field names.
Take a look here https://github.com/bugzilla/bugzilla/blob/5.2/Bugzilla/Search.pm#L557: