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
One answer
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.
Comments
Thanks for you answer Donald,
Here is my xpath expression:
"//attribute:customAttribute[@attribute:name='Green']/@attribute:literalName | //attribute:customAttribute[@attribute:name='Identifier']/@attribute:name"