Legacy Dev Forum Posts

 View Only

Sign Up

API call is not working for Edge List

  • 1.  API call is not working for Edge List

    Posted 06-05-2025 18:02

    Suresh_Kumar | 2019-09-26 10:54:39 UTC | #1

    Hello ,

    var request = require('request');

    function handleTokenCallback(body){ var options = { url: '*Calling Roles API here***', headers: { 'Authorization': body.tokentype + " " + body.accesstoken //console.log(body.tokentype,body.accesstoken) } };

    request(options, function (error, response, body) { if (!error && response.statusCode == 200) { //console.log(JSON.stringify(JSON.parse(body), null, 2)); console.log('printing the JSON') }else{ console.log('Printing Error: '+ error) console.log(body.tokentype + ' ' + body.accesstoken) } }); }

    secret = process.env.purecloudsecret; id = process.env.purecloudclient_id;


    The above code working fine if I pass this Roles URL -

    But, I dont get the JSON when I use this URL - "https://api.mypurecloud.de/api/v2/telephony/providers/edges"

    Can you please help?

    Regards, Suresh


    Suresh_Kumar | 2019-09-26 11:00:36 UTC | #2

    Works well for https://api.mypurecloud.de/api/v2/authorization/roles

    doesnt work for https://api.mypurecloud.de/api/v2/telephony/providers/edges


    Becky_Powell | 2019-09-26 19:24:15 UTC | #3

    Suresh, are you receiving an error when you call /api/v2/telephony/providers/edges? What do you mean by "doesn't work"?


    Suresh_Kumar | 2019-09-27 09:17:42 UTC | #4

    Thanks for the reply, Becky. I am getting the response now for the API call. Basically I had to give permission to the application created in Integrations->OAuth.

    I am getting the reponse when I call for Edges details. Is it possible to send one more API calls to get the trunk list in the code mentioned?


    Becky_Powell | 2019-09-27 15:25:41 UTC | #5

    Hi Suresh,

    Here is the API resource that you can call to fetch the list of available trunks for a given Edge: https://developer.mypurecloud.com/api/rest/v2/telephonyprovidersedge/#get-api-v2-telephony-providers-edges--edgeId--trunks.

    --Becky


    Suresh_Kumar | 2019-09-27 16:56:04 UTC | #6

    Thanks Becky. I was getting the response. But suddenly, i am getting the below error. { Error: unable to get local issuer certificate at TLSSocket.onConnectSecure (tlswrap.js:1058:34) at TLSSocket.emit (events.js:198:13) at TLSSocket.finishInit (tlswrap.js:636:8) code: 'UNABLETOGETISSUERCERTLOCALLY' } Can you please advise.


    Becky_Powell | 2019-09-27 17:42:53 UTC | #7

    It sounds like your company network is using a cert in its proxy that your code doesn't trust: nodejs/node#3742.

    Possible solution: https://stackoverflow.com/questions/46968937/nodejs-request-post-not-working-for-https-website/46968984#46968984


    system | 2019-10-28 17:42:54 UTC | #8

    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: 6110