Bug 1630691 - The 'search bug' API's result does not match the documentation.
Summary: The 'search bug' API's result does not match the documentation.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Bugzilla
Classification: Community
Component: Documentation
Version: 5.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: PnT DevOps Devs
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-19 06:36 UTC by Jingyi Wang
Modified: 2025-10-16 23:52 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-10-04 00:14:44 UTC
Embargoed:


Attachments (Terms of Use)
The actual results. (1023.28 KB, text/plain)
2018-09-19 07:27 UTC, Jingyi Wang
no flags Details

Description Jingyi Wang 2018-09-19 06:36:37 UTC
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:

Comment 1 Jingyi Wang 2018-09-19 07:27:09 UTC
Created attachment 1484584 [details]
The actual results.

Comment 2 Jingyi Wang 2018-09-19 07:30:21 UTC
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)

Comment 3 Jeff Fearn 🐞 2018-09-19 21:55:25 UTC
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.

Comment 4 Jingyi Wang 2018-09-21 03:26:07 UTC
(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?

Comment 5 Jeff Fearn 🐞 2018-09-21 03:51:27 UTC
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

Comment 6 Jeff Fearn 🐞 2018-10-04 00:14:44 UTC
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


Note You need to log in before you can comment on or make changes to this bug.