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.
Comments
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 03 '20, 8:21 a.m.Hi Allison
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Dec 03 '20, 8:43 a.m.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.
Allison Schwoboda
Dec 03 '20, 5:30 p.m.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:
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jul 12 '21, 8:47 a.m.Hi Allison