Hi, I need to create a phone using the Genesys Cloud API and Python.
Using the Genesys Cloud web interface, I can create the phone simply by entering the following 4 parameters:
1 - Phone Name
2 - Base Settings
3 - Site
4 - Person
Unfortunately, when I try to use the API, using the post_telephony_providers_edges_phones method, it gives me an error saying it can't find the line.
Where can I find the line? How can I fix it? What should the API call body structure be?
This is my code:
api_client = PureCloudPlatformClientV2.api_client.ApiClient() \
.get_client_credentials_token(GENESYS_CLOUD_CLIENT_ID, GENESYS_CLOUD_CLIENT_SECRET)
api_instance = PureCloudPlatformClientV2.TelephonyProvidersEdgeApi(api_client)
body_phone = PureCloudPlatformClientV2.Phone()
body_phone.name = "WebRTC_API_TEST_CR9"
body_phone.site = PureCloudPlatformClientV2.Site()
body_phone.site.id = "e6*****1-2**7-**61-9f**-3**********0" # valid site id
body_phone.phone_base_settings = PureCloudPlatformClientV2.PhoneBaseSettings()
body_phone.phone_base_settings.id = "9######4-c8##-##d2-9##7-2##########5" #valid base_setting id
body_phone.web_rtc_user = PureCloudPlatformClientV2.User()
body_phone.web_rtc_user.id = "1######6-##51-4e##-#92#-2##########2" # id of a person without phone but with phone license (Cloud CX 3)
api_response = api_instance.post_telephony_providers_edges_phones(body_phone)
And this is the error the API returns.
HTTP response body: {"message":"A phone must contain at least one line.","code":"lines.required","status":400,"contextId":"e734a81d-7f1a-4310-b1e4-a519c8292034","details":[],"errors":[]}
I tried reading the tutorial, but it's only in JavaScript, not Python, and I can't figure out where I'm going wrong.
Thank you so much in advance if anyone is kind enough to help me resolve this issue.
Regards.
#PlatformAPI------------------------------
Giampy
------------------------------