question

tim-martin8637 avatar image
tim-martin8637 asked Tyler Liu commented

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

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:

'https://platform.devtest.ringcentral.com/restapi/v1.0/account/%2b+13136366191/extension/101/ring-out'

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



getting started
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

anton-nikitin avatar image
anton-nikitin answered
Tim,

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.
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

paco-vu avatar image
paco-vu answered
Hi Tim,

You have some redundant parameters without values. Try this instead

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

+ Phong
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered
https://platform.devtest.ringcentral.com/restapi/v1.0/account/%2b+13136366191/extension/101/ring-out

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'
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

tim-martin8637 avatar image
tim-martin8637 answered Tyler Liu commented
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.  

Json
{"from":{"phoneNumber":"+17134178892"},"to":{"phoneNumber":"+17132753591"},"playPrompt":true}

Request
{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
  Authorization: Bearer U0pDMTFQMDFQQVMwMHxBQUNPS09XNS1IYTlMQ1dQRnBjbC0zc3dxbkx1QlVFVlJBY24tdmg1QVpKV0ZmbW13V2Q4elNReTJNc1dHSUNLMG5SNF9QWWRPMEVYNEhPV3FzbEwwTUtuTXExWklRMzhUcm84RWFEc3FFZ0lVRkl6Z2RaZzc5RDE4Z1hnZGxLX0M4amZVc194TDlMd1FSbFg2Z29OZ2NhWEtYelBCdEJqd2swbm1UbmNfSmhmNnZaZTZYVTZ6LVRLM1paODIwY09EQ2N8eWxWN3l3fHFRcXhrYjJXd0ZoV3JSNEU4bS03NGc
  Content-Type: application/json; charset=utf-8
  Content-Length: 110
}}

Response
{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
1 comment
1 |1500 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

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.
0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys