Detecting 202 when calling get_conversation_recording

When calling the conversationsApi:

https://developer.mypurecloud.com/api/rest/v2/recording/#get-api-v2-conversations--conversationId--recordings

in the sync version of the call, it returns an array for recordings (I don't want to use the async version of the call).

However sometimes we get a 202, which means it's still transcoding, however I couldn't find any indication of how to detect a 202, rather than a 200? Should I call get metadata before and look at file status, or how should I handle that?
How do I detect a 202 if it just returns an array of recordings?

Please let me know?
Thanks!

The python SDK doesn't currently expose details about the raw response. If the response is empty, it's still transcoding. Once you get a response that contains data, the transcoding has completed.

So I shouldn't look at file_status? That means nothing?
What if there are no recordings? how would I know it's not just transcoding but an empty result?
IS there plans to expose the response code? Is there some way to know?

recordings_api = PureCloudPlatformClientV2ApiFactory.get_api_with_client_credentials('RecordingApi')
    record_meta = recordings_api.get_conversation_recordingmetadata(interaction_id)
    for record in record_meta:
        if record.file_state != InteractionsService.FILE_READY:
            raise Exception('File not ready yet, try again later')
    logging.info('found {} recording for interaction {}, will attempt to download them'
                 .format(len(record_meta), interaction_id))
    recordings = []
    while len(record_meta) != len(recordings):
        recordings = recordings_api.get_conversation_recordings(interaction_id,
                                                                max_wait_ms=max_wait_ms,
                                                                format_id=format)
    for recording in recordings:
        if recording.file_state != InteractionsService.FILE_READY:
            raise Exception('File not ready yet, try again later')
    return recordings

@tim.smith Have a look at my code and question please?

If there are no recordings, you'll get a 404, which will produce an error in the SDK. If there are recordings but they are transcoding, you will get a successful response, but it will be empty. If there are recordings and they are finished transcoding, you'll get a successful response with the results.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.