It's all about the answers!

Ask a question

how to query custom attribute for a value using RRC rest api


Binoy D'costa (9532737) | asked Jul 18 '13, 6:39 p.m.
 Below query just returns all Requirements which have the custom attribute, but what I'm looking for is to filter further based on a certain value of the custom attribute. Any help is appreciated:

Accepted answer


permanent link
Gabriel Ruelas (1.1k13) | answered Aug 01 '13, 12:33 p.m.

Those values can be extracted from the Instance shape,, use OSLC Name field as :


  <oslc:Property>
<oslc:valueType rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
<oslc:propertyDefinition rdf:resource="https://gradev.ibm.com:9444/rdm/types/_Jp-fMfkZEeKEG5px7R2FmA"/>
<oslc:range rdf:resource="https://gradev.ibm.com:9444/rdm/types/_JBgJ9PkZEeKEG5px7R2FmA"/>
<oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-one"/>
<dc:description rdf:parseType="Literal"></dc:description>
<dc:title rdf:parseType="Literal">Planned Release</dc:title>
<oslc:name>_Jp-fMfkZEeKEG5px7R2FmA</oslc:name>
</oslc:Property>

Binoy D'costa selected this answer as the correct answer

Comments
Binoy D'costa commented Aug 01 '13, 1:22 p.m.

I'm not following. I have a custom attribute called "Requirement ID" which is an attribute of type "string". I already know its "oslc:name" which is "_ry2_8ahPEeKkfY4h6KgkBA". The value of this attribute is typed in manually by the user and is a text.

What i want to do is to query artifacts using the RRC Rest api by the value of this attribute. Something like: show me all artifacts where the attribute _ry2_8ahPEeKkfY4h6KgkBA = "UMS"

Is this possible?

Thanks,
Binoy


1
Gabriel Ruelas commented Aug 02 '13, 12:22 p.m.

Yes, that should work,  I just successfully tried :
&oslc.prefix=rm_property=<https://gradev.ibm.com:9444/rdm/types/>
&oslc.select=*
&oslc.where=rm_property:_MkiPBPuOEeKrautu-HXo_w="MYTEXT"


Binoy D'costa commented Aug 05 '13, 6:46 p.m.
Gabriel, 

This works using curl on linux platform. I was trying to use REST client in chrome and I get different results. Should have tried this before. Thanks a bunch!

-Binoy
 

One other answer



permanent link
Gabriel Ruelas (1.1k13) | answered Jul 24 '13, 11:23 a.m.
Hi,
Have you seen the query samples in https://jazz.net/library/article/1197. it looks like you will have to specify the complete attribute URL.

Comments
Binoy D'costa commented Jul 25 '13, 3:24 p.m.

Yes, i don't see a way to filter a particular attribute by its value. The examples talk about filtering requirements by attribute but not by their values. Is there a way?

Thanks,
Binoy


Gabriel Ruelas commented Jul 26 '13, 1:06 p.m.

is following query similar to what you are looking for ?
"To query for all artifacts that have the Status property set to Approved, use a query similar to. Note: To run this type of query, you must obtain the value of the Approved state from the instance shape. After you have the value, create a query that is like this one:"
"

&oslc.prefix=rm_property=<https://grarrc.ibm.com:9443/rm/types/>&oslc.select=*&oslc.where=rm_property:_PfIW0OrtEeGaNr-hWVrMiw=<https://grarrc.ibm.com:9443/rm/types/_PamcJOrtEeGaNr-hWVrMiw%233e9db9f1-3d5c-4716-aae0-f48d49260a8b>
"


Binoy D'costa commented Jul 30 '13, 4:58 p.m.

yes similar but for custom attributes which is of type string not enumeration. How do I get the value of it from the instance shape? I don't think this is possible.

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.