Description of problem: When using the 'search bug' API, the returned result contains lots of confusing unnecessary information and is different from what is introduced in the documentation. https://bugzilla5.redhat.com/docs/en/html/api/core/v1/bug.html#rest-search-bugs Version-Release number of selected component (if applicable): Bugzilla 5. How reproducible: Always. Steps to Reproduce: 1.Use Python, and 'import requests' 2.Use the API: GET /rest/bug/(id_or_alias). For example, requests.get('https://bugzilla5.redhat.com/rest/bug?qa_contact=yhong@redhat.com') 3.Print the result. Actual results: The returned result contains lots of unnecessary characters that is confusing. Expected results: Should return clear-structured fields of bugs without redundant characters. Additional info:
Created attachment 1484584 [details] The actual results.
The actual result is in the attachment. Here's the source code to reproduce: import requests if __name__ == "__main__": r = requests.get('https://bugzilla5.redhat.com/rest/bug?' + 'qa_contact=yhong') print json.loads(r.text)
The RPC Interface is experimental, you will find bugs, and we may not prioritize fixing them. From https://bugzilla5.redhat.com/docs/en/html/integrating/api/Bugzilla/WebService/Server/REST.html?highlight=experimental#description "Please note that everything about this REST interface is EXPERIMENTAL." (In reply to Jingyi Wang from comment #0) > > requests.get('https://bugzilla5.redhat.com/rest/bug?qa_contact=yhong@redhat. > com') I think that server has some firewall or proxy issues that cause it to do weird things. If you try partner-bugzilla.redhat.com it will probably work. e.g. if you just click that link a few times, sometimes you'll get a nice json payload, other times you will get weird stuff.
(In reply to Jeff Fearn from comment #3) > The RPC Interface is experimental, you will find bugs, and we may not > prioritize fixing them. > > From > https://bugzilla5.redhat.com/docs/en/html/integrating/api/Bugzilla/ > WebService/Server/REST.html?highlight=experimental#description > > "Please note that everything about this REST interface is EXPERIMENTAL." > > (In reply to Jingyi Wang from comment #0) > > > > requests.get('https://bugzilla5.redhat.com/rest/bug?qa_contact=yhong@redhat. > > com') > > I think that server has some firewall or proxy issues that cause it to do > weird things. If you try partner-bugzilla.redhat.com it will probably work. > > e.g. if you just click that link a few times, sometimes you'll get a nice > json payload, other times you will get weird stuff. There are still some questions: 1. The solutions above are for Bugzilla 5, it's not stable and 'partner-bugzilla' still returns weird stuff. 2. If I use Bugzilla 4, which API should I use? If it is RPC, what would the server url be? could you give me an example?
I don't think the partner server is returning invalid data, at least I can't duplicate it. cCick this link, attach any invalid data you can get to this bug. https://partner-bugzilla.redhat.com/rest/bug?qa_contact=yhong@redhat.com I know nothing about python, maybe you can give python-bugzilla a try? It has an active community. https://github.com/python-bugzilla/python-bugzilla
I don't think this is a bug, I think your script is mishandling the attachment data. You can try something like this, which works fine for me: r = requests.get('https://partner-bugzilla.redhat.com/rest/bug?qa_contact=yhong@redhat.com', json=payload, allow_redirects=True, proxies=None) print r print r.status_code print r.json print r.raise_for_status() print r.headers print r.history