Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Error Creating Phone with APIs

    Posted 04-14-2025 10:40
    Edited by Giampiero Casu 04-14-2025 11:04

    I can't create the phone with the API (Python) in any way. Here it is the script and the error detail.
    Can you please help me?

    the error is "A phone must contain at least one line."

    Thank you very much.

            GENESYS_CLOUD_CLIENT_ID="********-****-****-****-************"
            GENESYS_CLOUD_CLIENT_SECRET="*******************************************"
            region = PureCloudPlatformClientV2.PureCloudRegionHosts.eu_west_1
            PureCloudPlatformClientV2.configuration.host = region.get_api_host()
            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_TEST10"
            body_phone.site = PureCloudPlatformClientV2.Site()
            body_phone.site.id = "f3501***-****-****-****-**********31"
            body_phone.phone_base_settings = PureCloudPlatformClientV2.PhoneBaseSettings()
            body_phone.phone_base_settings.id = "9ca39***-****-****-****-**********75"
            body_phone.web_rtc_user = PureCloudPlatformClientV2.User()
            body_phone.web_rtc_user.id = "356cd***-****-****-****-**********9e"  #a user without phone
            body_phone.line_base_settings = PureCloudPlatformClientV2.LineBase()
            body_phone.line_base_settings.id = "eb1fe***-****-****-****-**********08"
            api_response = api_instance.post_telephony_providers_edges_phones(body_phone)

    API post_telephony_providers_edges_phones----> ERROR DETAIL

    Reason: Bad Request
    HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '166', 'Connection': 'keep-alive', 'Date': 'Mon, 14 Apr 2025 14:20:12 GMT', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'ININ-Correlation-Id': '6b01e739-957f-415e-a102-451b92634872', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 45ea404abc16ac09e69747b3522700b8.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FCO50-P4', 'X-Amz-Cf-Id': 'f7wxxpwP4apc5iZEKTr9jCoITxX2h5BmIAgoBimxH_m_XNyK9VLiIA=='})

    HTTP response body: {"message":"A phone must contain at least one line.","code":"lines.required","status":400,"contextId":"6b01e739-957f-415e-a102-451b92634872","details":[],"errors":[]}


    #PlatformAPI

    ------------------------------
    Giampiero Casu
    ------------------------------



  • 2.  RE: Error Creating Phone with APIs

    Posted 04-16-2025 13:19

    please can someone help me?

    Thank you so much to anyone who wants to help me... I just can't solve it



    ------------------------------
    Giampiero Casu
    ------------------------------