I was getting an error when trying to submit a batch download request for recordings using the PythonSDK. Following the documentation here, I wrote this code:
# Format batch request body
try:
body = PureCloudPlatformClientV2.BatchDownloadJobSubmission()
body.batch_download_request_list = batch_request
print(f'SUCCESSFULLY FORMATTED BATCH REQUEST {i+1} OF {len(batch_request_body)}')
print(f'body: {body}')
except Exception as e:
print(f'Exception when formatting batch request body: {e}')
raise e
print(f'Posting batch request {i+1} of {len(batch_request_body)}...')
try:
result = recording_api.post_recording_batchrequests(body)
print(f'SUCCESSFULLY POSTED BATCH REQUEST {i+1} OF {len(batch_request_body)}')
except ApiException as e:
print(f'Exception when calling RecordingApi->post_recording_batchrequests: {e}')
raise e
When running this code, I would receive a 400 error with the following message:
Request list is empty after validation
When I looked at the printout of the "body", I saw the structure was as follows:
{'batch_download_request_list': [
{
'conversation_id': '***********',
'recording_id': '************'
}
]
}
However, when I look at the REST API documentation, I noticed the request should be formatted in camelCase, like this:
{'batchDownloadRequestList': [
{
'conversationId': '***********',
'recordingId': '************'
}
]
}
When I manually send the body in with that format, I successfully create the batch request. I'm not sure if I'm doing something wrong with the invocation of the "batch_download_request_list" method to format the body or if this is a bug with the SDK, but I thought I'd post in case anyone else is struggling with the same thing.
TL;DR, try formatting the body after the example in the REST API Documentation (link above) instead of relying on the SDK to format it properly (unless I am misunderstanding how to use the SDK )