How to request a list of artifacts in a project using Python REST API?
I am trying to access requirements using a Python API, and am having trouble with this query. Using the services query I got the baseURLs for requirement and folder queryCapability, and I've had success using the Folder Query Capability to browse folders and subfolders. However when I try the following request using the requirement queryCapability baseURL, I get a 403:Forbidden response.
self.headers = {'Content-type': 'application/x-www-form-urlencoded', 'OSLC-Core-Version': '2.0', 'Accept': 'application/rdf+xml'}
resp = requests.get('https://ServerName/rm/views?oslc.query=true&projectURL=https%3A%2F%2FServerName%2Frm%2Fprocess%2Fproject-areas%2F_1ipDAGUlEemksZVbt6XKiw',cookies=jar,verify=False,headers=self.headers)
Thank you in advance
|
One answer
403 indicates the authenticated user likely doesn't have privileges to do the operation. Did you try the request with Postman?
But the queryCapability service provides a queryBase URL that can be used with GET to do OSLC queries. I'm not sure what the GET that failed with 403 is trying to do, it doesn't contain an OSLC query.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Hi Allison
As Jim says your url doesn't have a parameter like oslc.where (which is the query) or oslc.select (which specifies which attributes you want returned in the results). These shouldn't be used with the folder query URL because it doesn't support them, but the resources query does need them - you don't usually want to get the entire server results back, it would be too big and put load on your server.
Could you help provide some instruction on how to add these parameters to the query? For example, would the identifier be the ID of a component that holds other artifacts? And should these parameters be appended to the URL in the GET request like this:
Hi Allison