[RESOLVED] Create Work Task Work Item via OSLC
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>
Accepted answer
xmlns:dcterms="http://purl.org/dc/terms/1.1"
should bexmlns:dcterms="http://purl.org/dc/terms/"
Comments
I tried this but didnt work.
<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:contextId>_Kw3GkmJHEeODZojFwTfvdw</rtc_cm:contextId>
<dc:description>This is new TRY</dc:description>
<dc:title>DENEME TASK</dc:title>
<dc:type rdf:resource="https://wat01ibmclm.int.teb.com.tr:9443/ccm/oslc/types/_Kw3GkmJHEeODZojFwTfvdw/task"/>
</oslc_cm:ChangeRequest>
I post to this URI: https://wat01ibmclm.int.teb.com.tr:9443/ccm/oslc/contexts/_Kw3GkmJHEeODZojFwTfvdw/workitems
2 other answers
'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).
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>
Comments
Robert Carter
Sep 12 '18, 12:49 p.m.I have changed my POST data to:
Richard Good
Sep 12 '18, 12:50 p.m.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 ;-(