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

Need help updating a Workitem via OSLC

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.

0 votes



6 answers

Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
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.

0 votes


Permanent link
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

0 votes


Permanent link
Thanks, I've got it now...

0 votes


Permanent link
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!

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
× 10,936

Question asked: Feb 22 '10, 8:39 p.m.

Question was seen: 7,601 times

Last updated: Feb 22 '10, 8:39 p.m.

Confirmation Cancel Confirm