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

Using OSLC and REST problems

I am trying to get information of the workitems through OSLC and REST, i was able to get all the information but when i try to get the Attached Files i get this error:

RESPONSE:
Status Code: 400 BAD REQUEST.

PAGE:
You have followed a direct link to content hosted in a Jazz server. This page has been presented to ensure that a malicious website cannot use cleverly crafted content to circumvent security. If you would like to access the content, please use the link below.
Download content


The link is the one i am following form my application.
Any ideas? I just need to get the information in a txt file...

0 votes

Comments

Were you able to resolve this? I am having the same problem trying to get photos of users through the API.

example:
https://SERVER:PORT/jazz/resource/content/_Gut94H7ZEeKejIlVdm5llw.jpg

Unfortunately, trying to get to the photo results in the message you posted.



4 answers

Permanent link
What content type are you specifying in the Accept header of the request? I think you should only get that response if it thinks the request is coming in from a web browser (i.e. looking for HTML). The Accept header should indicate text/xml, application/xml or application/rdf+xml.

0 votes


Permanent link

I have this problem as well and setting the request header's type and accept values did not make a difference. I tried:

(The following pseudo-code is in VB.Net syntax)

dim Http as MSXML2.XMLHTTP

... Stuff up here...

Http.setRequestHeader("Content-Type", "application/xml")

Http.setRequestHeader("Accept", "text/xml")

Http.send(jazzUserid & "&" & JazzPassword)

This generates status 400 "Bad Request".

Note that this worked in RTC 4.0.1 and stopped working when we upgraded to 4.0.5.

0 votes


Permanent link
 somebody has the solution, also I am having the same problem

0 votes


Permanent link

I was having the same issue above (a POST or GET on the authentication URL from VBA was dying from 400 errors, even though the exact same code works from Perl/cuRL.)

The solution (at least for me) was that you have to set the User-Agent from your response header in VBA like so:
Set http = CreateObject("Msxml2.ServerXMLHTTP.6.0")
....
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
http.setRequestHeader "User-Agent", "MS Internet Explorer"

Whatever user-agent value is being sent from VBA's COM interface class is considered invalid by RTC, no idea why and RTC offers not useful hint in the return headers (or it could be I'm not understanding them.)

Making this change allows me to successfully POST a login, get my JSESSIONID, and continue making calls on this object just fine.

By the way, the other COM interface works as well: Set http = CreateObject("MSXML2.XMLHTTP")
For simplicity, especially if you're making a light amount of REST calls, this is probably fine as it piggybacks from IE and uses the old UrlMon interface according to Microsoft. However, if you need fine-grain control over cookies you probably will want to go with the other interface in my code snippet above.

Keep in mind that enabling TLS 1.2 for these COM interfaces is a huge pain too, in the case that your organization may restrict SSLv2/v3/TLS1.0/TLS1.1 and requires TLS 1.2, as for Windows 7 users you will actually need to make registry edits defined here: https://support.quovadisglobal.com/kb/a433/how-to-enable-tls-1_2-on-windows-server-2008-r2.aspx

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,938
× 369

Question asked: Jun 16 '11, 3:32 p.m.

Question was seen: 8,665 times

Last updated: Nov 26 '17, 3:32 p.m.

Confirmation Cancel Confirm