Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Fetching custom attributes for multiple items at the same time REST API

I'm using REST API to fetch my data from NDG. I want to fetch the customAttribute attribute from the item so im using this url to reach the item I want to fetch: https://<localhost>/rm/publish/resources?resourceURI=_vu0WQVrkEeagjv4ysZcIGA


Then i'm using a Xpath expression to fetch the correct attributes, in this case: 
"//attribute:customAttribute[@attribute:name='Valid for Radio']/@attribute:literalName

Right now im looping through all the artifacts and that causes about 80 calls to the server. Which takes a very long time, is there a better way to fetch the custom attributes from multiple items?

0 votes



One answer

Permanent link

Regardless custom attributes or built-in ones, if you want to retrieve them from multiple items, simply add the UUID after "resourceURI=", separated by commas. So your request URL will look like
https://<localhost>/rm/publish/resources?resourceURI=_vu0WQVrkEeagjv4ysZcIGA,_vu0WQVrkEeagjv4ysQneQP,_vu0WQVrkEeagjv4ysUslQD
or something like that.

Some points to note when using this technique.
1. Do not put too many IDs in the URL as it may end up too long and get rejected by the server.
2. With multiple items in the response, beware that your application needs more memory to cope with the content.
3. When using Xpath to read the attributes, make sure to read the ID as well, so that you know which attribute value is for which artifact/item.

0 votes

Comments

Thanks for you answer Donald,


Eventhough im using the method you mentioned with combining all the items to one long string and doing calls it doesnt seem to work any faster. It is less calls to the database but when im doing my Xpath expression it takes a very long time. 

Might the loadtime be so long becuase my xpath expression is to complex?

Here is my xpath expression:

"//attribute:customAttribute[@attribute:name='Green']/@attribute:literalName | //attribute:customAttribute[@attribute:name='Identifier']/@attribute:name"

Is there any way to make it shorter if that is the reason for the long loadtime?

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: May 12 '17, 9:31 a.m.

Question was seen: 1,928 times

Last updated: May 18 '17, 7:28 a.m.

Confirmation Cancel Confirm