Highlighted
Contributor.
Contributor.
797 views

PC Rest API using Python - Authentication 404

Hi

I am trying to authenticate Performance center using Rest API and Python but it failing with following message

is my request correct ??

is there a setup/config change needed on PC Server to enable Rest API?

if someone has a valid request, can you post it?

 here is the request

headers = {'Authorization':'Basic', 'username':'some1', 'password': 'no1'}

about username and password

I open up tools - Password Encoder - enter username - generate - use that encoded in python script.

same process repeated on password. 

r = requests.get('http://hostname:8080/LoadTest/rest/authentication-point/authenticate', params=headers)

and below is the response

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 </title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /LoadTest/rest/authentication-point/authenticate. Reason:
<pre> Not Found</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

0 Likes
2 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: PC Rest API using Python - Authentication 404

Hi

A few suggestions:

  • PC related questions are better answered in the PC practitioners forum here
  • There are many questions relating REST API with PC that you'll find with solutions and explanations
  • I recommend reviewing the latest webinar on REST API here for additional information

Good Luck,

Lior

 

0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: PC Rest API using Python - Authentication 404

Hi,

I see 2 possible issues with your request:

  1. the "hostname" in your url is the ALM hostname, not PC Server. You need to send the request to PC Server, not ALM server, and possible also remove the port 8080 as PC rest API is hosted in IIS, and by default is on port 80 (unless you manually changed it).
  2. The credential are sent incorrectly. Here is how to send credentials:
    1. build a string in the following format: [username]:[password]
    2. encode it to base 64.
    3. send a header "Authorization: Basic [YourEncodedCredentials]"

I hope this helps, let us know the outcome.

Regards,

Oren.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.