It's all about the answers!

Ask a question

How can I get multiple item attributes in the Reportable REST API?


Mitch Slater (156) | asked Jul 01 '22, 9:49 a.m.

 I'm trying to grab multiple attributes of any item or artifact from the Reportable REST API using XMLHttpRequest in JavaScript, but each time I try, I get an empty response back from the server. However, if I put the URI I'm using directly in my browser, I can see the XML result that I'm expecting. For example, this works:

https://server:port/ccm/rpt/repository/foundation?fields=projectArea/projectArea/name
but this doesn't:
https://server:port/ccm/rpt/repository/foundation?fields=projectArea/projectArea/(name|uniqueId)
The second URI does provide the desired information when input directly into a browser address bar, but sending a coded request results in a response with an empty responseText, responseType, and responseXML. Is there something here that I'm missing? Do I need additional headers included with my request? 
Thanks in advance for any insight you might have

2 answers



permanent link
Ralph Schoon (63.3k33646) | answered Jul 01 '22, 10:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I have explained how the reportable REST API for EWM works with an example here: https://rsjazz.wordpress.com/2022/03/02/ewm-reportable-rest-api/ . The example gets multiple work items and multiple attributes as well.


Comments
Mitch Slater commented Jul 01 '22, 10:18 a.m.

I appreciate your response, Ralph! I've been referring to your document quite frequently, it has been a really good resource so far as I've been trying to get started. From what I can tell, I've formulating my URIs just as you've described here, and it works great when requested from a browser, but I am unable to get a request through my coded GET request. It's especially perplexing that the format for selecting multiple attributes - with the /(att1|att2) format - has worked perfectly while working with the ETM REST API but is stumping me here.


Ralph Schoon commented Jul 01 '22, 10:25 a.m. | edited Jul 01 '22, 10:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
No idea. I think I have used my example through Python, but I am not sure. No time to check at the moment.

Are you authenticated?

The only thing, besides authentication (see my blog), could be the need to URL encode the URL.  

There are no additional headers needed (besides the ones involved with authentication which are handled on session level).

Ralph Schoon commented Jul 01 '22, 10:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you use RESTClient in the browser, it inherits the authentication from your login to the CCM. If you try that with Postman, you will not have that luxury and it will behave like an application that is not logged in.


Mitch Slater commented Jul 01 '22, 10:57 a.m.

We've been running our requests through OpenSocial gadgets embedded in the tool in order to inherit the authentication. I'll take a look at encoding the URL. I assume that's being done in some code we inherited, since it's worked for everything else up to this point, but I'm about out of ideas of things to look at. Appreciate the help!


permanent link
Mitch Slater (156) | answered Jul 01 '22, 11:06 a.m.

Got it working by running the widget from the mini dashboard while inside the EWM application. I was running it from the ETM application before, assuming that as long as I had the correct URL, my authentication and everything could be used to query any of our server applications. I'm still not exactly sure what's different between running the same widget while on each of the two tools, especially where I was allowed to get a single attribute while still it ETM, but I can get multiple attributes now.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.