Get_calls failing Invalid value for `recording_state`

Hi,

Working with the Python SDK, I am having issue with the function get_calls()
Using the Code example:

PureCloudPlatformApiSdk.configuration.access_token = g.session.access_token
PureCloudPlatformApiSdk.configuration.host = 'https://api.mypurecloud.ie'
api = PureCloudPlatformApiSdk.ConversationsApi()
result = api.get_calls()

If there is no call in the User queue it works as expected:
Output of result:

{'entities': [],
'first_uri': '/api/v2/conversations/calls?pageSize=0&pageNumber=1',
'last_uri': '/api/v2/conversations/calls?pageSize=0&pageNumber=1',
'next_uri': None,
'page_count': 0,
'page_number': 1,
'page_size': 0,
'previous_uri': None,
'self_uri': '/api/v2/conversations/calls?pageSize=0&pageNumber=1',
'total': 0}

Same result as with PostMan doing a direct request, so I believe my code is working.

Now when there is an Alerting Dialer Preview call in the user Queue; I get the following Stack error:

  File "/home/ec2-user/PureCloudLight/pc/lib/python2.7/site-packages/PureCloudPlatformApiSdk/models/call_conversation.py", line 181, in recording_state
    .format(allowed_values)
ValueError: Invalid value for `recording_state`, must be one of ['NONE', 'ACTIVE', 'PAUSED']

I can see that the recording_state in postman is "none", is it an issue with the value being case sensitive in python ?

"pageSize": 1,
"pageNumber": 1,
"total": 1,
"entities": [
{
"id": "930f809b-f6b4-4d72-828a-8f126690617d",
"participants": [],
"otherMediaUris": [
"/api/v2/conversations/callbacks/930f809b-f6b4-4d72-828a-8f126690617d"
],
"recordingState": "none",
"selfUri": "/api/v2/conversations/calls/930f809b-f6b4-4d72-828a-8f126690617d"
}
],
"selfUri": "/api/v2/conversations/calls?pageSize=1&pageNumber=1",
"firstUri": "/api/v2/conversations/calls?pageSize=1&pageNumber=1",
"lastUri": "/api/v2/conversations/calls?pageSize=1&pageNumber=1",
"pageCount": 1
}

Is it a known issue with this SDK ? I believe for now the only workaround is to make the API request directly.

Thanks,
Sebastien

There are two issues I've logged here:

  • API-1901 - make the Python handle values better (case insensitive comparison and include an unknown enum member in the SDKs)
  • CS-653 - Correct the documentation for the valid values. They are documented as upper case, but are being sent as lower case. Technically, "NONE" != "none" so anyone doing a comparison based on the literal value documented will have an issue, which is what the SDKs do.

If you need an immediate workaround, you can modify the Python SDK's source to use lowercase values in the comparison and use a custom build until these issues are resolved.

Thanks, I did not think of making the change to the source... I just tested and it seems to be an issue with few functions.

I just tested get_conversations and get_callbacks

Both have the same issue but with the STATE this time, if we can get this also corrected.

  File "/home/ec2-user/PureCloudLight/pc/lib/python2.7/site-packages/PureCloudPlatformApiSdk/models/callback.py", line 119, in state
    .format(allowed_values)
ValueError: Invalid value for `state`, must be one of ['ALERTING', 'DIALING', 'CONTACTING', 'OFFERING', 'CONNECTED', 'DISCONNECTED', 'TERMINATED', 'SCHEDULED', 'NONE']

It seems to be the same as it is lower case in PostMan:

  "state": "connected",

Thanks, I've noted the state property in CS-653 as well.