Legacy Dev Forum Posts

 View Only

Sign Up

Detecting 202 when calling get_conversation_recording

  • 1.  Detecting 202 when calling get_conversation_recording

    Posted 06-05-2025 18:08

    Dory_Z | 2019-09-09 14:43:44 UTC | #1

    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!


    tim.smith | 2019-09-09 16:47:01 UTC | #2

    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.


    Dory_Z | 2019-09-09 17:28:15 UTC | #3

    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?


    Dory_Z | 2019-09-09 17:31:59 UTC | #4

    recordingsapi = PureCloudPlatformClientV2ApiFactory.getapiwithclientcredentials('RecordingApi') recordmeta = recordingsapi.getconversationrecordingmetadata(interactionid) for record in recordmeta: if record.filestate != InteractionsService.FILEREADY: raise Exception('File not ready yet, try again later') logging.info('found {} recording for interaction {}, will attempt to download them' .format(len(recordmeta), interactionid)) recordings = [] while len(recordmeta) != len(recordings): recordings = recordingsapi.getconversationrecordings(interactionid, maxwaitms=maxwaitms, formatid=format) for recording in recordings: if recording.filestate != InteractionsService.FILE_READY: raise Exception('File not ready yet, try again later') return recordings


    Dory_Z | 2019-09-09 17:34:06 UTC | #5

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


    tim.smith | 2019-09-09 18:35:33 UTC | #6

    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.


    system | 2019-10-10 18:35:37 UTC | #7

    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: 5988