Hi, I'm able to connect using the example provided below and print the get_authorization_permissions, but I'm not able to call "call_api" to access "/api/v2/telephony/providers/edges". Is there a example available how to use "call_api" or how do I check Edge servers using PureCloudPlatformClientV2 ?
Also make sure you look at the reference document Tim has posted above. Each one of our API endpoints (and their corresponding SDKs) will show you the specific permissions you need to access the endpoint. In the endpoint above, it looks like your OAuth Client Credential grant needs to have a Role that has the telephony:plugin:all permission.
Thanks,
John Carnell
Manager, Developer Engagement
Tim, thank you. I found a way to do it using the code example below. But, I'm getting error for "get_telephony_providers_edge_diagnostic_nslookup" and "get_telephony_providers_edge_diagnostic_ping" . Any idea? Please check error below:
Let me check with some of my old team mates in Edge services. I know the developer who wrote the endpoints you are hitting. I have a suspicion but want to validate with her.
Thanks,
John Carnell
Manager - Developer Engagement
but when I use: body = PureCloudPlatformClientV2.EdgeNetworkDiagnosticRequest() #
I get : print(body) = 'host':'none' (not sure where I'm missing something here)
EdgeNetworkDiagnosticRequest has a mandatory field "host" and you need to set the value before passing it to the request. In your example you are just creating the instance of the request class but did not provide any value to the "host".
You would have to set your targeted IP/Host. The example in Python SDK is not showing that step.
So that would be:
body = PureCloudPlatformClientV2.EdgeNetworkDiagnosticRequest() # EdgeNetworkDiagnosticRequest | request payload to get network diagnostic
body.host = "The IP or host you want to ping"
To clarify, this is to request to run a ping command from the edge to this target IP/Host. So you should put something else than your edge IP.
As a side note, it you are using virtual edges (from Genesys Cloud Voice or BYOC Cloud), the ping will probably show 100% packet loss. The virtual edges are hosted on AWS and AWS tend to block any ICMP traffic (ping).
If you have a premise edge, it should work.
I am using BYOC Cloud and Virtual edges in my environment. So ping shows 100% packet loss. But I could use other command (I tried route and it works - didn't try nslookup and trace).
Hi @Jerome.Saint-Marc Jerome, indeed this works: body.host = ip
Thank you very much!
But I still can't find which function from this API should I call to get the information from the 'self_uri' returned. Do you have an example? Would this be "AsyncQueryResponse" ???
self_uri in the response refers to the resource that was requested. The SDKs operate based on calling functions on the API Client instance, not using explicit resource paths. If you want to request the same resource again, just make the same request again using the SDK.
Hi @tim.smith, I'm not sure if I make myself clear. In order to get the information from command ping (using the function: post_telephony_providers_edge_diagnostic_ping), I need curl the URL from self_uri right? At least this I understood from the example . So, I want to know if there is a function to request that URL without using curl or requests from python.
This would be like this:
Step 1 = POST (post_telephony_providers_edge_diagnostic_ping)
Step 2 = RESPONSE (self_uri)
Step 3 = GET (self_uri)
Step 4 = RESPONSE from GET : ping xx.x.x.x etc,etc,etc...
If you're making the POST request and immediately making the GET request, this seems expected. The ping operation will take several seconds to complete, which is why this task requires two requests. If you're not getting any data after waiting for a bit before checking the result, please open a case with Genesys Cloud Care to investigate why ping results are not eventually being populated.