It's all about the answers!

Ask a question

400 Bad Request using httpRequester


helene højrup (231912) | asked Apr 16 '13, 7:17 a.m.
Hi
IBM Rational ClearCase and Rational ClearCase LT: Guide to Managing Software Projects

I have a 400 Bad Request problem when I try to PUT my changes (I've just tried to update the title of an existing requirement).

PUT <the requirement URI>
OSLC-Core-Version: 2.0
accept: application/xml
If-Match: <the requirement etag>
Content-Type: application/rdf+xml

The response

400 Bad Request
Content-Type: application/rdf+xml; charset=UTF-8
...
the errormessage
https/1.1 400 (more info found at entry [b6027e3840337de9] in the RM application server log)

I can't fint this entry in the RM application server log?



Comments
helene højrup commented Apr 16 '13, 7:18 a.m.

hmmm... I didn't write the <meta data... > part - at least not on perpose


helene højrup commented Apr 16 '13, 8:13 a.m.

Sorry, I was looking at the wrong RM application server log. What it states in the end is:
Error 400: CRJZS5039E The ETag specified for If-Match is not legally formed &#40;see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html&#41;



Stef van Dijk commented Apr 16 '13, 10:53 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Typically when I want to perform a PUT, I perform the equivalent GET first to get the current state of various information (such as the artifact content and it's etag). Then I paste this over to my PUT request. Is that how you got the etag and can you show what the form of your etag value was?


helene højrup commented Apr 16 '13, 12:49 p.m.

Hi Stef
Thank you for your reply.

Yes I do the GET first to get the current state.
Form of my etag value?

This is what I get when I do the GET. Is that the answer to your question?

200 OK
Content-Type:  application/rdf+xml
OSLC-Core-Version:  2.0
Etag:  "_TsPdnx6MEeK-cKryrxtsYw"
Content-Encoding:  gzip
Vary:  Accept-Encoding
Content-Language:  en-US
Transfer-Encoding:  chunked
Date:  Tue, 16 Apr 2013 16:38:11 GMT
Server:  WebSphere Application Server/7.0


helene højrup commented Apr 16 '13, 1:19 p.m.

When I look into my licens I'm ticked off as a JazzUser. Do I have the rights to PUT? The reason why I'm asking is that when I look into the RM Application log, the following is also written:

Request
        PUT https://myServer:9443/jts/storage/com.ibm.rdm.resources/_e-W5U530EeKIgKWYSSfl6w HTTP/1.1
        X-Jazz-Owning-Context: myServer:9443/jts/process/project-areas/_OUfsouQmEeCDtNo-rCSbcA
        If-Match: _e-p0Qp30EeKIgKWYSSfl6w
        Content-Type: application/rdf+xml
        Authorization: OAuth ...something more...

When I try to GET https://myServer:9443/jts/storage/com.ibm.rdm.resources/_e-W5U530EeKIgKWYSSfl6w

I get the following
Error 403: CRJZS5068E Storage area is restricted. The authorization key is required to access the resource: storage/com.ibm.rdm.resources/_e-W5U530EeKIgKWYSSfl6w



Stef van Dijk commented Apr 16 '13, 2:07 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Yes. So when you set the headers for the PUT, are you providing that Etag value (including the quotes) on the If-Match?
It's also important to specify the net.jazz.jfs.owning-context, which is the full url of the project area which contains the resource.


helene højrup commented Apr 16 '13, 2:20 p.m.

I'm not including the quotes in the etag - and that is correct, right?
I willl try to take a look at the net.jazz.jfs.owning-context.


helene højrup commented Apr 16 '13, 2:30 p.m. | edited Apr 16 '13, 2:37 p.m.

The URL for the project area that I find in the RMcatalog right? For me it looks something like:
https://myServer:9443/jts/process/project-areas/_OUfsouQmEeCDtNo-rCSbcA

When I now try to PUT I get authorization error, and could this be due to may JazzUser rights?


helene højrup commented Apr 17 '13, 7:19 a.m.

Haha :D It worked with the quotes around the etag!
I didn't have to put in the net.jazz.jfs.owning-context.

Thank you a lot Stef!


Stef van Dijk commented Apr 17 '13, 8:32 a.m. | edited Apr 17 '13, 8:33 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Be careful about the net.jazz.jfs.owning-context. The PUT will succeed without it, but it may end up moving the resource to another context (specifically the PUBLIC_CONTEXT) at which point your artifact will "disappear" from the project/folder. You may be ok in your example as I forget which scenarios can cause this, but it wouldn't hurt to perform a GET again to verify the context is still as expected.

showing 5 of 10 show 5 more comments

Accepted answer


permanent link
Stef van Dijk (2.0k179) | answered Apr 16 '13, 3:14 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
You should include the quotes for the etag. In my testing, without them, you will get a 400 Bad Request error.

As to the authorization error, are you trying to GET/PUT directly to jts/storage? That would be a problem. There are additional steps you can take, in addition to requiring additional permissions, to be able to do this, but there's no reason you can't do this through the normal RM url. Something along the lines of:
https://myServer:9443/rm/resources/_e-W5U530EeKIgKWYSSfl6w (or rdm if this was a server migrated from 2.x)

Though I will add that a GET from RM will result in non-modifiable attributes being returned which must be removed from the content prior to using PUT. If you do not remove these, the PUT will fail, most likely with a 403 Forbidden, and list the problem attribute identifiers using a message of the form:
CRRRS8660E  Can not update system attribute: ...

And yes, the URL for the project area is as you've shown it.
helene højrup selected this answer as the correct answer

Your answer


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