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

[closed] Using OSLC API to create a workitem with a relatedartifact type of link

RTC405 used

Referring to https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Adding
a_Comment_to_a_Work_Item

We want to use POST to create a new workitem with a relatedartifact(in this case build result).
We tried the below xml file
===
<oslc_cm:ChangeRequest
    xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
    xmlns:dc="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/"
    xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
    xmlns:oslc_pl="http://open-services.net/ns/pl#">


    <rtc_cm:filedAgainst
rdf:resource="https://%HOST%:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_HKKrw8qJEeOXVt56FdOuiw"/>
    <oslc_cm:priority
rdf:resource="
https://%HOST%:9443/ccm/oslc/enumerations/_DXXIjMqJEeOXVt56FdOuiw/priority/priority.literal.l4"/>

        <oslc_cm:severity
rdf:resource="
https://%HOST%:9443/ccm/oslc/enumerations/_DXXIjMqJEeOXVt56FdOuiw/severity/severity.literal.l6"/>

        <rtc_cm:sony.mbu.workitem.attribute.ErrorCategory
rdf:resource="
https://%HOST%:9443/ccm/oslc/enumerations/_DXXIjMqJEeOXVt56FdOuiw/ErrorCategoryEnum/ErrorCategoryEnum.literal.l1"/>

        <dc:title> Build Error</dc:title>
        <dc:description>
          There is error in the build result
        </dc:description>
        <dc:subject> Build error </dc:subject>
        <dc:creator> bob </dc:creator>

<rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact
rdf:resouce="
https://%HOST%:9443/ccm/resource/itemOid/com.ibm.team.build.BuildResult/_Cs_FodwrEeOQYtqUlaSvVg"
oslc_cm:label="my label"/>
</oslc_cm:ChangeRequest>
==

curl command:
> curl -D - -k -b %COOKIES% -H
"Content-Type:application/x-oslc-cm-change-request+xml" -H "Accept:
text/xml" -X POST --data-binary
"@.\ConfigBuildTrackingWI_with_relatedArtifact.xml" %URL%
>new_task_temp.txt

When running, got the error like
<oslc_cm:status>400</oslc_cm:status>
<oslc_cm:message>missing the required parameters:

http://www.w3.org/1999/02/22-rdf-syntax-ns#resource</oslc_cm:message>

It seems the error is related to the link we tried to add:

<rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact
rdf:resouce="
https://%HOST%:9443/ccm/resource/itemOid/com.ibm.team.build.BuildResult/_Cs_FodwrEeOQYtqUlaSvVg"
oslc_cm:label="my label"/>

The question is:
1) Does OSLC API allow the user to add link to the workitem when it is created using POST or we have to create WI with POST first and then use PUT to add the link to the created WI?
2) If link can be added to WI when it is created, what could be wrong in the above XML?"
Appreciate if anyone can shed some lights on this questions. Thanks a lot.

0 votes


The question has been closed for the following reason: "Other" by dyang May 18 '14, 10:37 p.m.


One answer

Permanent link
We can use OSLC API to create relateartifact link type using POST command directly to create a new workitem with the link. The problem here is that "rdf:resource" is misspelled and once it is corrected, it works.
Closing this POST.

0 votes

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
× 60
× 49
× 17
× 17

Question asked: May 16 '14, 3:15 a.m.

Question was seen: 5,989 times

Last updated: May 18 '14, 10:37 p.m.

Confirmation Cancel Confirm