java - WebClient - Jira rest api, with unexpected result -


i'm trying fetch issues jira through jira rest api. when use curl it's no problem, , issues want. problem want through java code (i use maven changes plugin, small modifications), plugin doesn't find issues. 200 status response, response doesn't contain issues.

here snippet java code (the authentication done in setup):

    webclient client = setupwebclient(jiraurl);     dosessionauth(client);     client.replacepath("/rest/api/2/search");     client.type(mediatype.application_json_type);     client.accept(mediatype.application_json_type);     client.query("key", "<issue-key>");     response res = client.get();  

this gives me 200 response json:

{"startat":0,"maxresults":50,"total":0,"issues":[]} 

this curl request gives me expected ressult:

curl -u user:password -x -h "content-type:application/json" https://bankid.atlassian.net/rest/api/2/search?key=<issue-key>&maxresults=10 

i've tried using post , json query:

webclient client = setupwebclient(jiraurl); dosessionauth(client);  string jqlquery = new    jqlquerybuilder(log).urlencode(false).filter(filter).build();  stringwriter searchparamstringwriter = new stringwriter() jsongenerator gen = jsonfactory.creategenerator(searchparamstringwriter); gen.writestartobject(); gen.writestringfield("jql", jqlquery); gen.writenumberfield("maxresults", nbentriesmax); gen.writearrayfieldstart("fields"); gen.writestring("*all"); gen.writeendarray(); gen.writeendobject(); gen.close(); client.replacepath("/rest/api/2/search"); client.type(mediatype.application_json_type); client.accept(mediatype.application_json_type); log.debug("jql query [" + searchparamstringwriter.tostring() + "]"); response searchresponse = client.post(searchparamstringwriter.tostring()); 

it's same here. corresponding curl gives me expected result (one issue), returns 200 response no issues.

i can't seem find out what's wrong. pointers? also, possible see path client sends request (to make sure there isn't wrong set-up)? i've read through api haven't found anything.

is apache cxf use send rest call?

in general if notice difference between try manually , code does, helps enable logging, can compare whether code same thing (probably not).

for apache cxf, how enable logging described here:

even if not immediately, can useful add logs question here make easier other people spot problem.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -