Module 'PureCloudPlatformClientV2.api_client' has no attribute 'call_api'

Hi Team,

I am trying to fetch Routing Queues from: /api/v2/routing/queues while referring to: https://developer.genesys.cloud/routing/outbound/create-outbound-campaign-guide

But getting below error:

File "\PureCloudPlatformClientV2\apis\routing_api.py", line 4760, in get_routing_queues
response = self.api_client.call_api(resource_path, 'GET',
AttributeError: module 'PureCloudPlatformClientV2.api_client' has no attribute 'call_api'

Python script

import os

from PureCloudPlatformClientV2 import api_client
from PureCloudPlatformClientV2 import AuthorizationApi
from PureCloudPlatformClientV2.apis import scripts_api, outbound_api, routing_api

# Credentials
CLIENT_ID = os.getenv('GENESYS_CLOUD_CLIENT_ID')
CLIENT_SECRET = os.getenv('GENESYS_CLOUD_CLIENT_SECRET')

apiclient = api_client.ApiClient().get_client_credentials_token(CLIENT_ID, CLIENT_SECRET)
authApi = AuthorizationApi(apiclient)


# Set your own values here
CONTACT_LIST_NAME = "SET_ME"
QUEUE_NAME = "SET_ME"
SCRIPT_NAME = "SET_ME"

# Get contact list by name
outbound_api = outbound_api.OutboundApi(apiclient)
routing_api = routing_api.RoutingApi(api_client)
contact_lists = outbound_api.get_outbound_contactlists(name=CONTACT_LIST_NAME)
print(f"Contact Lists: {contact_lists}")

if (len(contact_lists.entities) == 0 or
        contact_lists.entities[0].name != CONTACT_LIST_NAME):
    raise ValueError("Failed to find Contact List")

contact_list_id = contact_lists.entities[0].id

print(f"Found contact list {contact_list_id}")

# Get queue by name
queue = routing_api.get_routing_queues(name=QUEUE_NAME)
print(f"Queues: {queue}")

if (len(queue.entities) == 0 or
        queue.entities[0].name != QUEUE_NAME):
    raise ValueError("Failed to Queue!")

queue_id = queue.entities[0].id
print(f"Found queue {queue_id}")

# Get script by name
script = scripts_api.get_scripts(name=SCRIPT_NAME)
print(f"Scripts: {script}")

if (len(script.entities) == 0 or
        script.entities[0].name != SCRIPT_NAME):
    raise ValueError("Failed to script!")

script_id = script.entities[0].id
print(f"Found script {script_id}")

PureCloudPlatformClientV2 version: 210.0.0

Hi,

When you initialised the routing_api you passed in api_client instead of apiclient which was what you named the variable above.

Regards,
Declan

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