question

Tammy Wolski avatar image
Tammy Wolski asked Anirban answered

Where do I put the access_token when calling a RingOut API?

I am using Password Flow to obtain an access token. This API call works. I can get a token. Now I need to call a RingOut. I have used all the same credentials (user name, password) as the API call to get a token, however I keep getting the response : "Invalid Authorization header":

I suspect this is because I am not including the access token in the URL, header, or params.

If you could give me an answer with respect to Postman, then I could translate that to my "real" app which is built in Lazarus.

Note: The phrase <redacted> is text that may contain sensitive information that has been removed

Note: "callerId" and "from" I assume is the same phone number... which is my dev sandbox account ?


So my question is: Where in Postman do I put the access token in the RingOut API call (URL, header, or params)?


Sent:

POST /restapi/v1.0/account/<redacted>/extension/101/ring-out HTTP/1.1

Content-Type: application/json

Content-Length: 412

Host: platform.devtest.ringcentral.com

Accept: application/json

User-Agent: Mozilla/3.0 (compatible; Indy Library)

Authorization: Basic <redacted>

from=<redacted>&to=<redacted>&callerId=<redacted>&country=Canada&playPrompt=true

Rcvd:

HTTP/1.1 401 Unauthorized

Server: nginx

Date: Sun, 23 Aug 2020 19:11:19 GMT

Content-Type: application/json

Content-Length: 175

Connection: keep-alive

WWW-Authenticate: Bearer realm="RingCentral REST API"

RCRequestId: 6d08a760-e574-11ea-b010-005056bb81b6


{

"errorCode" : "AGW-402",

"message" : "Invalid Authorization header",

"errors" : [ {

"errorCode" : "AGW-402",

"message" : "Invalid Authorization header"

} ]

}


rest apiring 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.

1 Answer

Anirban avatar image
Anirban answered

Authorization : Bearer <access_token>

Authorization will be Bearer when using generated access token. You have used Basic which is wrong

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.

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