Ragavi_Kanagalingam | 2020-06-03 06:45:36 UTC | #1
Hi All,
I'm working on AuditApi and using the function getauditsquerytransactionid_results() to get audit results by sending transaction ID as input.
When I'm passing transaction id directly in the function as below I'm able to get the response successfully
Request: apiresponse2 = apiinstance.getauditsquerytransactionidresults(transactionid='d68b93b7-057d-4acb-a12c-e5c93536a07a') print(api_response2.entities[0])
Response:
{'action': 'Read', 'client': {'id': '', 'selfuri': None}, 'context': {'conversationId': 'fbeb839f-6a72-4c97'}, 'entity': {'id': '10d895cd-5a4b-44', 'selfuri': '/api/v2/conversations/fbeb839f-6a72-4c97/recordings/10d895cd-5a4b-441d'}, 'entitytype': 'Recording', 'eventdate': datetime.datetime(2020, 5, 18, 11, 48, 58, tzinfo=tzutc()), 'id': '0f5c1f8c-2a83-4f89', 'message': None, 'propertychanges': [], 'remoteip': ['34.212.133.158', '64.252.141.160', '10.85.211.40'], 'servicename': 'Quality', 'user': {'id': '56def0eb-5551-4a8c-', 'name': None, 'selfuri': '/api/v2/users/56def0eb-5551-4a8c-'}}
But If I pass the same transaction ID as variable which I got as a response from other API, its throwing error.
Request: apiresponse1 = apiinstance.postauditsquery(body) transactionid = apiresponse1.id apiresponse2 = apiinstance.getauditsquerytransactionidresults(transactionid=t) print(api_response2.entities[0])
Response: Traceback (most recent call last): File "c:/AuditAPI.py", line 35, in <module> apiresponse2 = apiinstance.getauditsquerytransactionidresults(transactionid=apiresponse1.id) File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\apis\auditapi.py", line 202, in getauditsquerytransactionidresults response = self.apiclient.callapi(resourcepath, 'GET', File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\apiclient.py", line 396, in callapi return self._callapi(resourcepath, method, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\apiclient.py", line 220, in _callapi responsedata = self.request(method, url, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\apiclient.py", line 417, in request return self.restclient.GET(url, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\rest.py", line 205, in GET return self.request("GET", url, File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PureCloudPlatformClientV2\rest.py", line 200, in request raise ApiException(httpresp=r) PureCloudPlatformClientV2.rest.ApiException: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '218', 'Connection': 'keep-alive', 'Date': 'Wed, 03 Jun 2020 06:34:02 GMT', 'ININ-Correlation-Id': '5bc47bb5-bd8e-4b72-a9e9-9e82901937de', 'inin-ratelimit-count': '2', 'inin-ratelimit-allowed': '300', 'inin-ratelimit-reset': '60', 'Strict-Transport-Security': 'max-age=600; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 dc57dadfhjkdfl67afa847c0ba.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'BLR50-C2', 'X-Amz-Cf-Id': 'hrkXKihxUEzIkzPkrufodjflksjnlksdjdlAkdjfdksf'}) HTTP response body: {"message":"Query execution not completed for id [15de4436-8808-49c5-aa75-a11c99778f65]","code":"bad.request","status":400,"messageParams":{},"contextId":"5bc47bb5-bd8e-4b72-a9e9-9e82901937de","details":[],"errors":[]}
I don't know what I'm missing here. Can someone please help me out?
tim.smith | 2020-06-03 20:57:12 UTC | #2
Ragavi_Kanagalingam, post:1, topic:7951
Query execution not completed for id
The 400 bad request with this message means that the results are not yet available and you are not yet allowed to retrieve them. Use GET /api/v2/audits/query/{transactionId} to check the status of the query on an interval and wait until the state is succeeded before retrieving the results.
Ragavi_Kanagalingam | 2020-06-04 09:37:24 UTC | #3
Thanks Tim. It works!!
system | 2020-07-05 09:37:25 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 7951