Legacy Dev Forum Posts

 View Only

Sign Up

Server response internal server error

  • 1.  Server response internal server error

    Posted 06-05-2025 18:09

    araki-kazuo | 2023-10-26 09:53:44 UTC | #1

    Hello,

    I tried to get trunk information via api "TelephonyProvidersEdgeApi" with python program codes. However, Server responses 500 Internal Server Error. Here is details

    //Response from Console// py .\GetTrunkInfo.py

    Exception when calling TelephonyProvidersEdgeApi->gettelephonyprovidersedgestrunks: (500) Reason: Internal Server Error HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '228', 'Connection': 'keep-alive', 'Date': 'Thu, 26 Oct 2023 09:29:46 GMT', 'ININ-Correlation-Id': 'xxx-xxx-xxxx-xxxx-xxxx', 'Strict-Transport-Security': 'max-age=600; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 xxxxx.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'NRT20-C2', 'X-Amz-Cf-Id': 'odxJnE9cc0varj1BhLq9hxxxxxxg5kgsaCPop7XAKCgPLxxxxxxQ=='}) HTTP response body: {"message":"The server encountered an unexpected condition which prevented it from fulfilling the request.","code":"internal.server.error","status":500,"contextId":"xxxx-xxxx-xxxx-xxxx-387f208ff78c","details":[],"errors":[]}

    //python sorce//

    import sys import asyncio import time import requests import os import json import websockets import PureCloudPlatformClientV2 import re import base64 from pprint import pprint from datetime import date from PureCloudPlatformClientV2.rest import ApiException from PureCloudPlatformClientV2.models import response print("-------------------------------------------------------------") print("- Get TrunkInformations -") print("-------------------------------------------------------------") CLIENTID = 'xxxxx' CLIENTSECRET = 'xxxxx' ORGREGION = 'apnortheast1' # eg. useast1 region = PureCloudPlatformClientV2.PureCloudRegionHosts.apnortheast1 PureCloudPlatformClientV2.configuration.host = region.getapi_host()

    authorization = base64.b64encode(bytes(CLIENTID + ":" + CLIENTSECRET, "ISO-8859-1")).decode("ascii") requestheaders = { "Authorization": f"Basic {authorization}", "Content-Type": "application/x-www-form-urlencoded" } requestbody = { "granttype": "clientcredentials" } response = requests.post("https://login.mypurecloud.jp/oauth/token", data=requestbody, headers=requestheaders) responsejson = response.json() tokennumber = responsejson['accesstoken']

    PureCloudPlatformClientV2.configuration.accesstoken = tokennumber

    api_instance = PureCloudPlatformClientV2.TelephonyProvidersEdgeApi()

    page_number = 1 # int

    Page number (optional) (default to 1)

    page_size = 25 # int

    Page size (optional) (default to 25)

    sort_by = 'name' # str

    Value by which to sort (optional) (default to 'name')

    sort_order = 'ASC' # str

    Sort order (optional) (default to 'ASC')

    edge_id = '' # str

    Filter by Edge Ids (optional)

    trunkbaseid = '' # str

    Filter by Trunk Base Ids (optional)

    trunk_type = '' # str

    Filter by a Trunk type (optional)

    try: apiresponse = apiinstance.gettelephonyprovidersedgestrunks(pagenumber=pagenumber, pagesize=pagesize, sortby=sortby, sortorder=sortorder, edgeid=edgeid, trunkbaseid=trunkbaseid, trunktype=trunktype) pprint(apiresponse) except ApiException as e: print("Exception when calling TelephonyProvidersEdgeApi->gettelephonyprovidersedges_trunks: %s\n" % e)

    Do you have Any idea on how to solve this error?

    Thanks , Kazuo Araki


    Declan_ginty | 2023-10-26 11:16:29 UTC | #2

    Hi,

    Please open a case with Genesys Cloud care to investigate. 5xx errors cannot be investigated via the forum.

    Regards, Declan


    araki-kazuo | 2023-10-27 03:21:13 UTC | #3

    Hi, Thank you very much for reply. I issued case to Customer Care.

    As a result, problem did not solved, but I changed python code describing with not use namespace.

    Regards, Kazuo Araki


    system | 2023-11-27 03:21:48 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 22755