OSCL--cannot return JSON representation
Hi,
I create a query and represent it in a URL, https://nsjazz.raleigh.ibm.com:8002/jazz/oslc/projectareas?oslc_cm.query=dc:title=%22Mashup%20Center%22&oslc_cm.properties=rdf:resource.
Assuming the URL is stored in variable url, I execute the following:
I then get the response as follows:
However, the response (stored in variable json), is not in json format. I've tried using different resource formats such as rdf, xml, etc. but each time I get the same result. Is there something that I'm missing or need to do?
Any help is appreciated. Below is the value of my json variable after getting the response.
I create a query and represent it in a URL, https://nsjazz.raleigh.ibm.com:8002/jazz/oslc/projectareas?oslc_cm.query=dc:title=%22Mashup%20Center%22&oslc_cm.properties=rdf:resource.
Assuming the URL is stored in variable url, I execute the following:
HttpGet getMethod = new HttpGet(url);
getMethod.addHeader("Content-Type", "application/json");
getMethod.addHeader("Accept", "text/json");
httpClient.execute(getMethod);
I then get the response as follows:
InputStream is = httpResponse.getEntity().getContent();
String json = convertStreamToString(is);
However, the response (stored in variable json), is not in json format. I've tried using different resource formats such as rdf, xml, etc. but each time I get the same result. Is there something that I'm missing or need to do?
Any help is appreciated. Below is the value of my json variable after getting the response.
<html>
<head>
<meta>
<meta>
<title></title>
<link>
<link>
<style>
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;
}
</style>
</head>
<body>
<noscript><div>Javascript is either disabled or not available in your
Browser</div></noscript>
<div>Loading...</div>
<div></div>
<script>
djConfig = {
isDebug: false,
usePlainJson: true,
baseUrl: "/jazz/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/*null*/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/jazz";
net.jazz.ajax._webuiPrefix = "/web/";
</script>
<script></script>
<script>
/* <CDATA> */
</script>
<script>
/* <CDATA> */
</script>
</body>
</html>
One answer
Matthew,
Are you already authenticated ? This looks like it may be the challenge form auth part.
This could be part of your snippet that you are leaving out but generally you need to get a secure resource, this will challenge you for auth, then you authenticate based on the challenge, and then you are ready to actually get a secure resource.
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Appendix_A
-Sean
Are you already authenticated ? This looks like it may be the challenge form auth part.
This could be part of your snippet that you are leaving out but generally you need to get a secure resource, this will challenge you for auth, then you authenticate based on the challenge, and then you are ready to actually get a secure resource.
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Appendix_A
-Sean