IBM ETM REST api returns response in html format while doing GET call for a testscript
Hi Team,
When we are trying to fetch test script details from ETM using REST api it always returns html response but the status code is 200. Could you please hep on this .
Auth : Basic Auth , username and password
Headers : Accept application/xml
Method : GET
Response : _small part of response pasted below)
html lang="en-in">
<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="/qm/web/_style/?include=C~&etag=CDmfWCYswjS_en_IN&_proxyURL=%2Fqm&ss=cDLmu">
<link rel="icon" type="image/png" href="/qm/web/net.jazz.ajax/suite32.png" sizes="32x32"
media="(min-resolution: 120dpi)">
<link rel="icon" type="image/png" href="/qm/web/net.jazz.ajax/suite16.png" sizes="16x16">
Please guide us how to get xml response.
Is it possible to update the test script tests using this REST apis?
Thanks in advance.
Jyothsna
Accepted answer
You're probably not authenticated. Are you sure your server accepts Basic auth and if it does that the username+password are correct?
Look at the response headers - if there's X-com-ibm-team-repository-web-auth-msg: authrequired then you aren't authenticated.
Do the same GET (without the basic auth) in a browser REST client (not Postman, I've had variable success in the past with Postman) when you've logged in in another tab; does it work?
Once authenticated I'd expect that you'd need to use headers Accept: application/rdf+xml and OSLC-Core-Version: 2.0
I don't know much about updating ETM using the APIs, never really tried that beyond updating a test result.
HTH
Ian
2 other answers
Hello Ian,
Thanks a lot for the reply. Yes in browser I could open the proper test script with given url. As you mentioned that could be authentication issue because I can see X-com-ibm-team-repository-web-auth-msg: authrequired in response headers.
It would be great if you suggest how to make my server to accept basic authentication with username and password?
Secondly, as per my basic understanding from the article https://jazz.net/library/article/1376 as this is Reportable rest api the OSLC headers are not required. Please correct me if my understanding is wrong.
Thanks in advance,
Jyothsna
Comments
This article describes how to configure the application container for BASIC authentication - but I strongly recommend you don't do this. See https://jazz.net/library/article/75 - look at the disadvantages of BASIC auth. I'm not sure how using BASIC auth affects general browser use, because I've never seen a server configured for BASIC auth.
If you're coding your API calls then stick with FORM authentication and code the login when you receive a response with the header X-com-ibm-team-repository-web-auth-msg: authrequired - a very terse description of this is here https://jazz.net/wiki/bin/view/Main/WritingAJazzClient
Also see https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication which gives a broader view of authentication methods including when using JAS, and covering the FORM authentication steps in more detail.
Ah yes you're using reportable rest - so no need for the OSLC-Core-Version header and use Accept: application/xml. API documentaiton is here https://jazz.net/wiki/bin/view/Main/RqmApi
You may need to specify the configuration using header Configuration-Context or parameter oslc_config.context.