I want to use the ring-out restful api. I can get a token but get error calling api

  • 1
  • Question
  • Updated 1 year ago

I want to use the ring-out restful API. I have written the code to successfully return a access token, but when I take the token and call the ring-out api I get the reasonphrase "Not Found"

this is what my url looks like: 


and my json I post:

{\"from\": {\"phoneNumber\": \"+13136366191\", \"forwardingNumberId\": \"\"}, \"to\": {\"phoneNumber\": \"+17134178892\", \"callerid\": \"\"}, \"playPrompt\": true, \"country\": { \"id\" : \"\" } }

Not sure what I am doing wrong. 

I can share code if need be. 

Thank you in Advance

Photo of Tim Martin

Tim Martin

  • 80 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 3,024 Points 3k badge 2x thumb

please read this to understand better how resources are addressed in our REST API: https://developer.ringcentral.com/api-docs/latest/index.html#!#Resources.html

Your mistake is the way how you are referring to account and extension in URI. You should use internal ID or tilde, not phone number/extension number.
Photo of Paco Vu

Paco Vu

  • 506 Points 500 badge 2x thumb
Hi Tim,

You have some redundant parameters without values. Try this instead

{"from": {"phoneNumber": "+13136366191"}, "to": {"phoneNumber": "+17134178892"}, "callerid": "+13136366191"}, "playPrompt": true }

+ Phong
Photo of Tyler Long

Tyler Long, Official Rep

  • 9,828 Points 5k badge 2x thumb

In the uri above, account ID and extension ID are invalid. They should be internal IDs. Or you can use "~" to indicate the current account and extension: https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ring-out'
Photo of Tim Martin

Tim Martin

  • 80 Points 75 badge 2x thumb
Sorry I am just now getting back to this, but what do you mean internal IDs, main phone number and extension?

The app I created is a server only app and I am attempting to force a call via our CRM (click to call application).  I have tried every thing i can think of.  this is my latest attempt.  


{Method: POST, RequestUri: 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ring-out', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
  Accept: application/json
  Content-Type: application/json; charset=utf-8
  Content-Length: 110

{StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
  Connection: keep-alive
  RCRequestId: 9a579238-3d8a-11e8-8369-005056bb594d
  RoutingKey: SJC11P01PAS02
  X-Rate-Limit-Group: heavy
  X-Rate-Limit-Limit: 10
  X-Rate-Limit-Remaining: 9
  X-Rate-Limit-Window: 60
  Date: Wed, 11 Apr 2018 13:16:54 GMT
  Server: nginx/1.10.2
  Content-Length: 236
  Content-Language: en-US
  Content-Type: application/json; charset=UTF-8

Again, i can get my token using grant type = password without any problem.  I just can't seem to get the ring-out to work

Is there any thing that should be running on my desktop, link Ring Central for windows?

Thank you again and I appreciate your thoughts and ideas.

Tim Martin
Photo of Tyler Long

Tyler Long, Official Rep

  • 9,788 Points 5k badge 2x thumb
You are writing C#. Do you want to use the official library: https://github.com/ringcentral/ringcentral-csharp-client ? it will make your life easier.

For the response you post above. Could you please read the content out of "Content: System.Net.Http.StreamContent". Then we can get a detailed error message and we will know what happened.