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

[RESOLVED] Create Work Task Work Item via OSLC

I am using the Firefox Plugin, RESTClient, to attempt to create an out of the box work item of type task.  Here are my details.

I am using the creation URL:
https://domain.com/ccm/oslc/contexts/_VZV2ULQuEeKCua2t-np-3w/workitems/task
I am using the "PUT" method

PUT Headers
Content-Type: application/rdf+xml
OSLC-Core-Version: 2.0

Request Body:
<?xml version="1.0" encoding="UTF-8"?>
  <rdf:RDF
    xmlns:rtc_ext='http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/' 
xmlns:dcterms='http://purl.org/dc/terms/'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:oslc='http://open-services.net/ns/core#'
xmlns:oslc_cm='http://open-services.net/ns/cm#'
xmlns:rtc_cm='http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/'
xmlns:oslc_cmx='http://open-services.net/ns/cm-x#'>;
<oslc_cm:ChangeRequest
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
xmlns:jp="http://jazz.net/xmlns/prod/jazz/process/1.0/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:oslc_qm="http://open-services.net/xmlns/qm/1.0/"
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:jd="http://jazz.net/xmlns/prod/jazz/discovery/1.0/"
xmlns:oslc_rm="http://open-services.net/xmlns/rm/1.0/">;
<dcterms:title>Test Task Work Item from OSLC</dcterms:title>
</oslc_cm:ChangeRequest>
</rdf:RDF>

I am receiving the following error:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:oslc="http://open-services.net/ns/core#">
<rdf:Description rdf:about="https://domain.com/ccm/oslc/contexts/_VZV2ULQuEeKCua2t-np-3w/workitems/task">
</rdf:Description>
<oslc:Error rdf:about="#n0">
<oslc:message>null</oslc:message>
<oslc:statusCode>405</oslc:statusCode>
</oslc:Error>
</rdf:RDF>

0 votes

Comments

I have changed my POST data to:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rtc_ext='http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/' 
xmlns:dcterms='http://purl.org/dc/terms/'
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:oslc='http://open-services.net/ns/core#'
xmlns:oslc_cm='http://open-services.net/ns/cm#'
xmlns:rtc_cm='http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/'
xmlns:oslc_cmx='http://open-services.net/ns/cm-x#'>;
<oslc_cm:ChangeRequest
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/"
xmlns:dcterms="http://purl.org/dc/terms/1.1"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
xmlns:jp="http://jazz.net/xmlns/prod/jazz/process/1.0/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:oslc_qm="http://open-services.net/xmlns/qm/1.0/"
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:jd="http://jazz.net/xmlns/prod/jazz/discovery/1.0/"
xmlns:oslc_rm="http://open-services.net/xmlns/rm/1.0/">;
<dcterms:title>Test Task Work Item</dcterms:title>
<dcterms:description>Test Task Work Item from OSLC</dcterms:description>
<dcterms:type rdf:resource="https://rtc:9443/jazz/oslc/types/_VZV2ULQuEeKCua2t-np-3w/task"/>;
</oslc_cm:ChangeRequest>
</rdf:RDF>

And now I get this result:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oslc="http://open-services.net/ns/core#" > <rdf:Description rdf:nodeID="A0">; <oslc:message>'Save Work Item' failed. Preconditions have not been met: The 'Summary' attribute needs to be set (work item &lt;09:03:46&gt;).</oslc:message> <oslc:statusCode>403</oslc:statusCode> <rdf:type rdf:resource="http://open-services.net/ns/core#Error"/>; </rdf:Description> </rdf:RDF>

I thought for work item type, task. The summary field is:
<dcterms:title>Test Task Work Item</dcterms:title>

I'm also getting this exact same error doing the exact same thing.

dcterms:title is the Summary attribute isn't it?

Get a 403 forbidden error all headers seem ok, I'm definitely getting through to RTC, it just doesn't like some formatting, so I get what appears to be a bogus error

Can anyone help, bit stuck ;-(


Accepted answer

Permanent link
I have found the problem:
xmlns:dcterms="http://purl.org/dc/terms/1.1" 

should be
xmlns:dcterms="http://purl.org/dc/terms/"

Rosa Naranjo selected this answer as the correct answer

0 votes


2 other answers

Permanent link
If you are using latest Rational Team Concert (e.g. V4.0.3), another header is required.

 'X-Jazz-CSRF-Prevent' = 'JSESSIONID'

JESSIONID can be obtained from cookie file.  Cut and Paste the value (from FireFox cookie), then put this value into header.

This change was introduced to prevent Cross site request forgeries (CSRF).

0 votes


Permanent link

I don't think the previous answers are helpful, you need enclosing  rdf:description tag around the title, description and filedAgainst data, in a lot of project areas you need a filedAgainst because you will only be able to write to particular team categories, the wiki and answers in this forum in regard to creating work items via OSLC seem either wrong or out of date. Hopefully this answer will help someone else, I spent a considerable time getting it wrong when all I needed was an enclosing rdf:description tag. The following should create a work item with summary, description and filedAgainst, you will need to replace filedAgainst for it to work for you, or delete it and try it in an unlocked down project area

<rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

xmlns:acp="http://jazz.net/ns/acp#"

xmlns:oslc="http://open-services.net/ns/core#"

xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"

xmlns:process="http://jazz.net/ns/process#"

xmlns:dcterms="http://purl.org/dc/terms/"

xmlns:oslc_cm="http://open-services.net/ns/cm#"

xmlns:acc="http://open-services.net/ns/core/acc#"

xmlns:oslc_pl="http://open-services.net/ns/pl#"

xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"

xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/" >

<rdf:Description>

<dcterms:title rdf:parseType="Literal">Test from Powershell</dcterms:title>

<dcterms:description rdf:datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral">Note that this will increase the complexity of the tool a fair bit.</dcterms:description>

<rtc_cm:filedAgainst rdf:resource=https://YourServer/ccm/resource/itemOid/com.ibm.team.workitem.Category/yourId/>

</rdf:Description>

</rdf:RDF>

0 votes

Your answer

Register or log in 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.

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
× 516
× 62

Question asked: Aug 21 '13, 3:18 p.m.

Question was seen: 7,325 times

Last updated: Sep 12 '18, 12:50 p.m.

Confirmation Cancel Confirm