Call to put_routing_queue fails with "AttributeError: 'numpy.int64' object has no attribute 'swagger_types'"

Hi,

I am trying to write code to update attributes of a Queue using the "put_routing_queue" API. I am applying the below settings

  1. Queue Name
  2. Service Level
  3. Skill Evaluation Method
  4. ACW Settings
  5. On Hold Prompt (BETA enabled on this Org)
  6. Calling Party Number

When I use the API Explorer and manually feed in the Queue ID and the above settings, the API executes correctly and the Queue is updated. But when I use the SDK, I am getting an error in the invocation itself.

What I have done in the code as a summary

  1. Read all the Queue settings above from an input Excel sheet using Pandas and entered this into variables
  2. Obtained Client Credentials and instantiated the Routing API
  3. Instantiated the component objects to hold the settings - WritableDivision, AcwSettings, ServiceLevel, MediaSettings, OnHoldPrompt
  4. Instantiated a QueueMediaSettings Object and assigned the MediaSettings object to the attribute "call".
  5. Instantiated a QueueRequest object and assigned it the settings from variables (queue name, Skill Evaluation Method, calling party number) and objects (WritableDivision, AcwSettings, OnHoldPrompt, QueueMediaSettings)
  6. Wrote the below code to push the settings to the Queue object
try:
        routing_api_response = routing_api_instance.put_routing_queue(queue_id, queue_update_request_body)
        print("Queue name " + req_body_queue_name + " settings updated successfully")
    except ApiException as e:
        print("Queue update to " + req_body_queue_name + " failed due to API Exception" % e)

I am getting the below error

Traceback (most recent call last):
  File "c:\Soumik Work\Code\update_Queue_Settings_Bulk.py", line 92, in <module>
    routing_api_response = routing_api_instance.put_routing_queue(queue_id, queue_update_request_body)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\apis\routing_api.py", line 10379, in put_routing_queue
    response = self.api_client.call_api(resource_path, 'PUT',
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 530, in call_api  
    return self.__call_api(resource_path, method,
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 324, in __call_api
    body = self.sanitize_for_serialization(body)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in sanitize_for_serialization
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in <dictcomp>
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in sanitize_for_serialization
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in <dictcomp>
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in sanitize_for_serialization
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 426, in <dictcomp>
    return {key: self.sanitize_for_serialization(val)
  File "C:\Users\609049066\AppData\Local\Programs\Python\Python310\lib\site-packages\PureCloudPlatformClientV2\api_client.py", line 423, in sanitize_for_serialization
    for attr, _ in iteritems(obj.swagger_types)
AttributeError: 'numpy.int64' object has no attribute 'swagger_types'

What am I doing wrong? I've checked the Sample Code in the API Explorer as well as in SDK Documentation pages, and the invocation is exactly as it should be.

All, found it and solved the issue!!! Basically, I was reading the data to update the Queues from an Excel sheet, and I was trying to build an iterative logic to read the data into a Pandas dataframe, and then update each Queue as per each row in the Dataframe. The issue was that one of the variables which I was using to contruct the QueueRequest object for the Request Body didn't have the correct data type. So I forced the data types explicitly using Python's built-in functions, and it worked like a charm!!