It's all about the answers!

Ask a question

Getting html Repose when try to login into RTC using Postman


gaurao khadse (15113) | asked Jan 28 '21, 12:33 a.m.

I try to get defect and post a defect using rest api.

When i try with postman its working fine.
But while try using java code using jersey rest client, its gives me html page as response.
 
Header values I set as below in the sample code.     
                RestRequest request = new RestRequest();
request.getHeaders().put("Accept", "application/json");
request.getHeaders().put("Authorization", "Basic anlvdGk6anlvdGk=");
request.setBaseUrl("https://192.168.2.222:9443/ccm");
request.setPath("/resource/itemName/com.ibm.team.workitem.WorkItem/2");
request.setMethod("GET");

Response :
status - 200 and below html page
<!DOCTYPE html>
<!--
  Licensed Materials - Property of IBM
  (c) Copyright IBM Corporation 2005, 2015. All Rights Reserved.
  
  Note to U.S. Government Users Restricted Rights:
  Use, duplication or disclosure restricted by GSA ADP Schedule
  Contract with IBM Corp.
-->

<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=10">
<title></title>

<link type="text/css" rel="stylesheet" href="/ccm/web/_style/?include=A~&etag=JLGO3lIcQGU_en_US&_proxyURL=%2Fccm&ss=MEwIR">
<link rel="shortcut icon" href="/ccm/web/net.jazz.ajax/jazz.ico">

<style type="text/css">
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;
}
</style>

</head>

<body class="claro">
<noscript><div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div></noscript>
<div id="net-jazz-ajax-InitialLoadMessage">Loading...</div>
<div id="net-jazz-ajax-WorkbenchRoot"></div>
<script type="text/javascript">
djConfig = {
isDebug: false,
layout: "",
usePlainJson: true,
baseUrl: "/ccm/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/null/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/ccm";
net.jazz.ajax._appPath = "/ccm/auth/authrequired";
net.jazz.ajax._webuiPrefix = "/web/";
</script>
<script type="text/javascript" src="/ccm/web/_js/?include=A~&etag=JLGO3lIcQGU_en_US&_proxyURL=%2Fccm&ss=MEwIR&locale=en-us"></script>

<script type="text/javascript">
require("dojo/main").getObject('jazz.core.loader', true)._serverStartup="MEwIR";
require("dojo/main").getObject('jazz.core.loader',true)._loaded=["A"];
</script>

<script type="text/javascript">
/ <![CDATA[ /
dojo.addOnLoad( function() {
net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired");
});
/ ]]> /
</script>
</body>
</html>
 


Thanks.


Comments
David Honey commented Nov 14 '22, 6:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Gregory Persaud, I have converted your answer to a comment. If your post is a comment, please use Post comment in future rather than enter it as an answer. Thanks.


Ralph Schoon commented Nov 14 '22, 6:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I banned the user as they edited the comment and added an AD link. This was a typical meaningless answer that was then edited later. If you see new answers or comments on old questions with a lot of views, this is often to prepare spamming or ads. 

One answer



permanent link
Ralph Schoon (62.7k33643) | answered Jan 28 '21, 6:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 You have to be authorized, which you are apparently not ("net.jazz.web.app.authrequired"). See https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/ use form auth.


Note: the response 200 is not enough, the location header in the response must not be "/auth/authfailed" either.

Your answer


Register or to post your answer.