It's all about the answers!

Ask a question

Using OSLC and REST problems


Matias Rodriguez (4611011) | asked Jun 16 '11, 3:32 p.m.
edited Mar 03 '14, 5:03 a.m. by Sreerupa Sen (1.0k4)
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...

Comments
Mike Shkolnik commented Oct 23 '13, 4:52 p.m.

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
Nick Edgar (6.5k711) | answered Jun 17 '11, 12:07 p.m.
JAZZ DEVELOPER
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.

permanent link
Nate Decker (37814761) | answered Jan 22 '14, 9:23 a.m.

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.


permanent link
Jose Mendoza (1) | answered Apr 25 '14, 1:58 p.m.
 somebody has the solution, also I am having the same problem

permanent link
Winston Enos (33116) | answered Nov 26 '17, 3:32 p.m.

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

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.