Server response internal server error

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->get_telephony_providers_edges_trunks: (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("-------------------------------------------------------------")
CLIENT_ID = 'xxxxx'
CLIENT_SECRET = 'xxxxx'
ORG_REGION = 'ap_northeast_1' # eg. us_east_1
region = PureCloudPlatformClientV2.PureCloudRegionHosts.ap_northeast_1
PureCloudPlatformClientV2.configuration.host = region.get_api_host()

authorization = base64.b64encode(bytes(CLIENT_ID + ":" + CLIENT_SECRET, "ISO-8859-1")).decode("ascii")
request_headers = {
"Authorization": f"Basic {authorization}",
"Content-Type": "application/x-www-form-urlencoded"
}
request_body = {
"grant_type": "client_credentials"
}
response = requests.post("https://login.mypurecloud.jp/oauth/token", data=request_body, headers=request_headers)
response_json = response.json()
token_number = response_json['access_token']

PureCloudPlatformClientV2.configuration.access_token = token_number

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)
trunk_base_id = '' # str | Filter by Trunk Base Ids (optional)
trunk_type = '' # str | Filter by a Trunk type (optional)
try:
api_response = api_instance.get_telephony_providers_edges_trunks(page_number=page_number, page_size=page_size, sort_by=sort_by, sort_order=sort_order, edge_id=edge_id, trunk_base_id=trunk_base_id, trunk_type=trunk_type)
pprint(api_response)
except ApiException as e:
print("Exception when calling TelephonyProvidersEdgeApi->get_telephony_providers_edges_trunks: %s\n" % e)

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

Thanks ,
Kazuo Araki

Hi,

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

Regards,
Declan

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

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