It's all about the answers!

Ask a question

Need help updating a Workitem via OSLC


m sawires (1462268) | asked Feb 22 '10, 8:39 p.m.
Hello,
I'm trying to write a Java OSLC client to read/write and update Workitem. I can read workitems fine but I'm having difficulties updating them.
This is what I'm doing; for instance I want to update the workitem title:
- Do a GET to retrieve the workitem title.
- Do a PUT with a defined header "IF-MATCH" with the ETAG retrieved in the GET previously.

The PUT looks something like below. Obviously I'm doing something wrong as I'm getting an INVALID URI. How can I specify updated properties such as title?
https://localhost:9444/jazz/oslc/contexts/_KOF8MAwqEd-ai4wmUH0wzw/workitems?oslc_cm.properties=dc:title <oslc_cm:ChangeRequest xmlns:dc="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/"> <dc:title>New Title</dc:title> </oslc_cm:ChangeRequest>



Thank you for guiding me.

6 answers



permanent link
Udaya Puthuraya (881421) | answered Feb 22 '10, 10:40 p.m.
Hello,

Is there RTC client for AIX available for download ?
Specifically I am interested in RTC command line tools ( scm ) for AIX.

These command lines tools are in included in the RTC client for Windows and Linux.

I could not find these tools for AIX in the RTC download area.
I plan to use it on AIX 6.1

Appreciate your help.

Udaya

permanent link
Patrick Streule (4.9k21) | answered Feb 23 '10, 4:38 a.m.
JAZZ DEVELOPER
I'm trying to write a Java OSLC client to read/write and update
Workitem. I can read workitems fine but I'm having difficulties
updating them.
This is what I'm doing; for instance I want to update the workitem
title:
- Do a GET to retrieve the workitem title.
- Do a PUT with a defined header "IF-MATCH" with the ETAG
retrieved in the GET previously.

The PUT looks something like below. Obviously I'm doing something
wrong as I'm getting an INVALID URI. How can I specify updated
properties such as title?
https://localhost:9444/jazz/oslc/contexts/_KOF8MAwqEd-ai4wmUH0wzw/workitems?oslc_cm.properties=dc:title
oslc_cm:ChangeRequest
xmlns:dc="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/"
dc:title>New Title</dc:title
/oslc_cm:ChangeRequest

The URL that you are PUTing to is the query URL, which explains the
Invalid URI error.

When you GET a work item, e.g. like
GET
https://server:port/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/123

You have to PUT the new contents back to the same URL.

Otherwise it looks good to me.

--
Regards,
Patrick
Jazz Work Item Team

permanent link
m sawires (1462268) | answered Feb 23 '10, 9:47 a.m.
Thanks Patrick but I still don't understand. What do you mean by "You have to PUT the new contents back to the same URL?"
Let's say I get a workitem with the URL : "https://localhost:9444/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/18"

How does the PUT url should look like to update for instance the workitem title?

Thanks for your help.

permanent link
Patrick Streule (4.9k21) | answered Feb 23 '10, 12:08 p.m.
JAZZ DEVELOPER
Thanks Patrick but I still don't understand. What do you mean by
"You have to PUT the new contents back to the same URL?"
Let's say I get a workitem with the URL :
"https://localhost:9444/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/18"

How does the PUT url should look like to update for instance the
workitem title?

You would create a PUT request in your HttpClient for the URL:
https://localhost:9444/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/18

The If-Match header contains the eTag from the previous GET request

The body of the PUT request contains

<oslc_cm>
<dc>New Title</dc>
</oslc_cm>

And the content type for the body needs to be
application/x-oslc-cm-change-request+xml

--
Regards,
Patrick
Jazz Work Item Team

permanent link
m sawires (1462268) | answered Feb 23 '10, 8:55 p.m.
Thanks, I've got it now...

permanent link
Roger Dunn (1654) | answered May 17 '11, 4:29 p.m.
I have an AbstractService subclass that intercepts save operations, and in my debugging I'd like to generate the URL for the work item given by the ISaveParameter.getNewState(). For example, something like this:

https://localhost:7443/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/10

Any tips on how to generate the URL for the IWorkItem returned by ISaveParameter.getNewState()?

Thanks!

Your answer


Register or to post your answer.