403 Forbidden error when trying to access the Clarity REST API

52 Views Asked by At

I am trying to retrieve information from Clarity REST API's using Python . So, as a part of this I just tried to get response code from an URL. When I am trying to get response from an URL regarding clarity URL like this, "https://clarity-url/rest/describe/index.html#!". I am getting a response of 403 [FORBIDDEN] error .

But when I am trying to get a response from an URL like this, "https://clarity-url/", getting response of 200. However, I am able to browse the both URL's. Could anyone help me to resolve this issue?

1

There are 1 best solutions below

0
Coda On

First off, "https://clarity-url/rest/describe/index.html#!" is not a valid REST endpoint. Try something easier. Since you mentioned the REST describe page you have the documentation. Let's use the project get endpoint.

Pick a project in the environment, look in the URL on the project properties or project team/staff page and grab the database ID from the URL. Then put it in the project get endpoint. For example:

https://clarity-url/ppm/rest/v1/projects/5001000

Every REST endpoint is authenticated so in python you will also have to handle that. Clarity supports BASIC and BEARER (token) authentication.

https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/clarity-project-and-portfolio-management-ppm-on-premise/16-1-0/reference/Clarity-REST-APIs/REST-API-Authentication.html

If you are trying to learn the REST, Clarity's REST API and python all at the same time maybe you should remove some of the variability and try one at a time.

  1. Use the describe page to try some REST calls
  2. Use Postman or something similar to authenticate to Clarity and get some REST calls working outside Clarity
  3. Then put it back into python and try your luck