I am using Python SDK to perform certain report operations. As part of that I am trying to download a report using sailpoint.v2024.ReportsDataExtractionApi.getReport(reportid,fileformat). This is returning an exception -
Reason: {“errorName”:“NotAcceptableException”,“errorMessage”:“RESTEASY003635: No match for accept header”,“trackingId”:“xyz”}
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Wed, 12 Feb 2025 07:36:20 GMT’, ‘Content-Type’: ‘application/json;charset=utf-8’, ‘Connection’: ‘keep-alive’, ‘Server’: ‘nginx’, ‘Vary’: ‘Origin, Access-Control-Request-Method, Access-Control-Request-Headers’, ‘SLPT-Request-ID’: ‘xxxx’, ‘Access-Control-Expose-Headers’: ‘SLPT-Request-ID, Content-Type’, ‘X-Robots-Tag’: ‘noindex’, ‘Content-Length’: ‘146’})
HTTP response body: detail_code=None tracking_id=‘xxxx’ messages=None causes=None
I am not setting any headers assuming SDK does the request part. Here’s the code. I am able to execute get_report_result successfully. Only the get_report is failing.
configuration = Configuration()
with sailpoint.v2024.ApiClient(configuration) as api_client:
api_instance=sailpoint.v2024.ReportsDataExtractionApi(api_client)
report_id = “ad5415c409b5497583dcde0bfa149ce5”
try:
api_reponse = api_instance.get_report(report_id,“csv”,“test.csv”)
print(api_reponse)
except Exception as e:
print(“Exception when calling get report: %s\n” % e)
I would look into the api_instance variable and make user it is returning what you expect. It could be that the hard coded id might be the root cause. I would expect the ID would be in the api_instance. Each time a report is ran I would think that the ID would change.
The hard coded id is the report id. I am able to fetch the report details and download the report with that id via postman. The same id fetches report details via python sdk, so I am guessing the api_instance is accurate.
Seems like a bug in python SDK to me, specifically on the get_report function.
Was able to get this to work by explicitly specifying the header accept. Postman didn’t need it and this was not marked as required in the python SDK either. Thank you @mpotti for your suggestions.
Create an instance of the API class
api_instance = sailpoint.v2024.ReportsDataExtractionApi(api_client)
task_result_id = 'ad5415c409b5497583dcde0bfa149ce5' # str | Unique identifier of the task result which handled report
file_format = 'csv' # str | Output format of the requested report file
name = 'Identities Details Report' # str | preferred Report file name, by default will be used report name from task result. (optional)
auditable = False # bool | Enables auditing for current report download. Will create an audit event and sent it to the REPORT cloud-audit kafka topic. Event will be created if there is any result present by requested taskResultId. (optional) (default to False)
headers = {
#'Content-Type': 'application/json',
#'Authorization': 'Bearer your_token',
'Accept': 'application/csv'
}
try:
# Get Report File
api_response = api_instance.get_report(task_result_id, file_format, name=name, auditable=auditable,_request_timeout=None,_headers=headers)
print("The response of ReportsDataExtractionApi->get_report:\n")
print(api_response)