POST/PUT Requirement with a Custom Attribute Using REST API / OSLC
![]()
Following the OSLC workshops, We have been able to create a new requirement in RRC using the REST API. The body used in the POST request is as below.
<?xml version="1.0" encoding="UTF-8"?> We have a custom attribute called How do we do it? Is there something like the following we can use along with the above body? <rm_property:_6m0UhJUTEeGjDYB2VGA7DA rdf:parseType="Literal">High</rm_property:_6m0UhJUTEeGjDYB2VGA7DA> We understand that the above format is not correct. What is the correct format we should use? |
8 answers
![]()
Here is the sample output of a Get to the type of an attribute: "https://gradev.ibm.com:9444/rdm/accessControl/_OcYF0sSMEeGA8-GkKWmlAA"
Output : <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:acp="http://jazz.net/ns/acp#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw"> <acp:accessControl rdf:resource="https://gradev.ibm.com:9444/rdm/accessControl/_OcYF0sSMEeGA8-GkKWmlAA"/> <rdfs:comment></rdfs:comment> <rdfs:label>GRADATATYPE</rdfs:label> </rdf:Property> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#2f257129-a0ee-4d8c-8d47-a72797f034ef"> <rdfs:comment></rdfs:comment> <rdfs:label>4</rdfs:label> </rdf:Property> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#e28b500e-77af-4f34-86f4-2ef1f70ad3dc"> <rdfs:comment></rdfs:comment> <rdfs:label>1</rdfs:label> </rdf:Property> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#9f02a905-9f06-4c31-873b-49fe8c8e36bb"> <rdfs:comment></rdfs:comment> <rdfs:label>5</rdfs:label> </rdf:Property> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#716d95cb-f50c-484e-8d0e-527702c1bff0"> <rdfs:comment></rdfs:comment> <rdfs:label>2</rdfs:label> </rdf:Property> <rdf:Property rdf:about="https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#17d50781-6691-4862-8041-ff9fb7dd04d1"> <rdfs:comment></rdfs:comment> <rdfs:label>3</rdfs:label> </rdf:Property> </rdf:RDF> In case user wants to set label 3, then user must specify the rdf:value for it: "https://gradev.ibm.com:9444/rdm/types/_-lxL8tDgEeGe18MmgIPNSw#17d50781-6691-4862-8041-ff9fb7dd04d1" Regarding Arun's last comment, a real value is being used and that is not allowed. |
![]()
If the attribute you are trying to PUT is described by the rm_property as you are describing
<pre> <rm_property:_6m0UhJUTEeGjDYB2VGA7DA rdf:parseType="Literal">High</rm_property:_6m0UhJUTEeGjDYB2VGA7DA> </pre> in that case, you can very well include it within the body when you POST or PUT. Comments But if i do this, it gives me a "403 Forbidden" error. rdf:parseType="Literal" is something i have copied from other lines in the body and i guess this is not the correct way to enter the value of a custom attribute . Moreover i do not know whether the value "High" will be directly acceptable. Could you please elaborate. All I have is the property id, rm_property:_6m0UhJUTEeGjDYB2VGA7DA The custom attribute is of the data type "Enumerated list of values". Can you elaborate on the custom attribute that you added? If you query with https://research.jazz:9443/rm/types/_6t0UYJUTEeGjDYB2VGA7DA with GET, you should get all the type definition for all the attributes and in that case, you shall be clear on this whether it is Literal or not. |
![]()
The above query gives me the artifact shape. In this shape, the artifact is described as follows
<oslc:Property> </oslc:Property> Next i used GET on the propertyDefinition (https://research.jazz:9443/rm/types/_6m0UhJUTEeGjDYB2VGA7DA) and i received the following response <rdf:RDF> </rdf:RDF> I request you to assist on how to create the correct format. Thank You, Arun Comments @ArunBatra: You should not put your clarifications as answer to your own question. You could edit the question and add the clarifications below it. The keeps thing intact. Ya sorry, the size was to big for the comment. I will keep the edit option in mind though. Thank You. |
![]()
So the allowed values are 0,1 and 2 and the data type is int. So, please try sending an int to that value within the range of 0.1.2. Something like this -
Comments I used <rm_property:_6m0uhjuteegjdyb2vga7da rdf:parsetype="int">0</rm_property:_6m0uhjuteegjdyb2vga7da> in the body to post a requirement, i got the 403 Forbidden again. When i excluded this from the body, the requirement created successfully. (i.e. without the custom attribute being set). This is not the correct format either. What can we try now? Hi Kangkan, This has become a major blocker for us. We would be grateful for any help we can get. Possibility for any solution? |
![]()
Thank You Gabriel for the great hint...
I am able to create a requirement with a custom attribute value. This is the line that worked for me. <rm_property:_6m0UhJUTEeGjDYB2VGA7DA rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA#85f26fb6-2f9c-40db-83ff-aefe1ab69618"></rm_property:_6m0UhJUTEeGjDYB2VGA7DA> The following is the property definition received from the Artifact Shape which I used for the formation of the above line. (for reference) <oslc:property> <oslc:Property> <oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/> <oslc:allowedValues> <oslc:AllowedValues> <oslc:allowedValue rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA#85f26fb6-2f9c-40db-83ff-aefe1ab69618"/> <oslc:allowedValue rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA#7dae3116-c257-4d97-88bd-a34f8f198d7c"/> <oslc:allowedValue rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA#8d078228-b25f-4609-8884-b0d38e0aa6ab"/> </oslc:AllowedValues> </oslc:allowedValues> <oslc:propertyDefinition rdf:resource="https://research.jazz:9443/rm/types/_6m0UhJUTEeGjDYB2VGA7DA"/> <oslc:range rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA"/> <oslc:defaultValue rdf:resource="https://research.jazz:9443/rm/types/_6a5Yj5UTEeGjDYB2VGA7DA#8d078228-b25f-4609-8884-b0d38e0aa6ab"/> <oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-one"/> <dc:description rdf:parseType="Literal"/> <oslc:name>Priority</oslc:name> </oslc:Property> Cheers..!! Comments Hi there
|
![]()
By using the OSLC workshop, is there a limit of how many requirements can be created in RRC using the REST API?
|
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.
Comments
In Short, How to update a custom attribute using RRC Rest API?
Any possible solutions are welcome as it has become a blocker for us...
Thanks, Arun