It's all about the answers!

Ask a question

Add/Append related artifacts to Workitem


Luca D (111) | asked Aug 24 '18, 5:02 a.m.
edited Aug 24 '18, 5:10 a.m. by Ralph Schoon (63.5k33646)

 Hi everyone,

i need to append to a workitem some related artifacts using curl rest api. i'm able to add a related artifacts using a command like this:

 curl -D - -k -b $COOKIES -c $COOKIES -H "Content-Type: application/x-oslc-cm-change-request+json" -H "Accept: application/json" -X PATCH -d '{"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact": {"rdf:resource":"'$BUILDPATH'","oslc_cm:label":"Included in Build: '$BUILD'"} }' $HOST/oslc/workitems/$WORKITEM/

but if i call again this api the new value override the old one. 
There is a way to append the new value insted of rewrite the all "related artifacts" property.
i'm new in rtc api usage so hope this question doesn't sounds stupid :).

Thanks.  



One answer



permanent link
Ralph Schoon (63.5k33646) | answered Aug 24 '18, 5:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 24 '18, 5:10 a.m.

 You have to first retrieve all related artifacts, then add your new ones and save them all together.


Comments
Luca D commented Aug 24 '18, 5:18 a.m.

 The problem is that i cant retrieve all artifacts at the same time. So i need a way to add a new one later

 


Luca D commented Aug 24 '18, 5:26 a.m.

is there a documentation about curl api? 


Ralph Schoon commented Aug 24 '18, 8:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

That is how the API works. You GET the representation of the resource, you add, modify or remove stuff, then you PUT the result. If you just put one relationship, all the existing ones are deleted.

CURL is an application, bot an API. CURL allows to use REST or HTML APIs.

http://open-services.net/bin/view/Main/CmSpecificationV2 is the API specification for the OSLC REST API. 

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.