ringcentral-legacy-api-proxy

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2018 License: MIT Imports: 12 Imported by: 0

README

RingCentral Legacy API Proxy

Build Status Go Report Card Docs License Stack Overflow Chat

This is a proxy service that allows apps using RingCentral's legacy RPC APIs to use the new RingCentral REST APIs seamlessly. End-of-Life for the legacy APIs is targeted for the 10.2 release, August 9, 2018. Use of this proxy can enable your app to use the new REST APIs with the same interface as the legacy RPC APIs.

The following is a list of legacy API calls. The ones with checks are currently supported:

Note: a new query string parameter is provided, format=json, which instructs the service to return the REST API JSON response. If this is not provided, the response is converted to a legacy API response.

TL;DR

Install this app with the following quick steps:

  1. Login to Developer Portal: https://developer.ringcentral.com
  2. Create an app with "Platform Type" Server-only (No UI).
  3. Select permissions required: RingOut for RingOut call; ReadAccounts for RingOut list and Faxes for FaxOut
  4. Save sandbox Client ID, Client Secret
  5. Click Deploy to Heroku below. Use Sandbox Client ID and Client Secret with the server URL: https://platform.devtest.ringcentral.com .
  6. Run API calls until you can gradate your app.
  7. Click to graduate your app
  8. Update your Heroku environment variables or create a 2nd Heroku app
  9. Run in production

Caveats

  1. The RingCentral REST API is subject to Rate Limits:

https://developer.ringcentral.com/api-docs/latest/index.html#!#APIRateLimits.html

Contact us if your app is running into these limits.

Prerequisites

Create a RingCentral app at the developer portal: https://developer.ringcentral.com. Access is included with many RingCentral accoutns so just click 'Sign in' to continue.

Create an app with the following setting.

App Type: Server-only (No UI)

Ensure that Password grant is set.

Select the permissions you need. There are a total of three permissions for all legacy APIs, but you should just select the ones you need as you will need to exercise all the permissions to graduate your app.

Permission Required for
RingOut RingOut call, status, cancel
ReadAccounts RingOut list
Faxes FaxOut

Configuration

This application needs the following configuration variables:

Variable Required Description
RINGCENTRAL_CLIENT_ID yes Your application's Client ID
RINGCENTRAL_CLIENT_SECRET yes Your application's Client Secret
RINGCENTRAL_SERVER_URL yes Your RingCentral server url, e.g. Sandbox: https://platform.devtest.ringcentral.com , Production: https://platform.ringcentral.com

Installation

Deploying to Heroku
$ heroku create
$ git push heroku master
$ heroku open

or

Deploy

After you click the button above, you will need to enter the environment variables above into the Heroku web console.

Once this is up, you can make API calls by swapping service.ringcentral.com for your Heroku hostname, e.g. myherokuapp.herokuapp.com as follows:

https://<myHerokuApp>.herokuapp.com/ringout.asp?cmd=call&username=<myUsername>&password=<myPassword>&to=<myToNumber>&from=<myFromNumber>

Note: the app.json specifies a free dyno which will sleep due to inactivity. If you wish to use Heroku dyno that does not sleeps, clone this repo and update your app.json. Learn more about Heroku Dyno types here:

Running Locally
$ go get github.com/grokify/ringcentral-legacy-api-proxy
$ cd ringcentral-legacy-api-proxy
$ go build main.go
$ RINGCENTRAL_SERVER_URL=https://platform.devtest.ringcentral.com \
  RINGCENTRAL_CLIENT_ID=<myClientId> \
  RINGCENTRAL_CLIENT_SECRET=<myClientSecret> \
  main

Example API Calls

RingOut call

$ curl -XGET 'http://localhost:8080/ringout.asp?Username=<myUsername>&Password=<myPassword>&Cmd=call&to=<toNumber>&from=<fromNumver>&Format=json'

RingOut list

$ curl -XGET 'http://localhost:8080/ringout.asp?Username=<myUsername>&Password=<myPassword>&Cmd=list&Format=json'

FaxOut
$ curl -XPOST 'http://localhost:8080/faxout.asp' \
  -F 'Username=<myUsername>' \
  -F 'Password=<myPassword>' \
  -F 'Recipient=<recipient>' \
  -F 'Coverpagetext=<coverPageText>' \
  -F 'Resolution=High' \
  -F 'Attachment=@test_file.pdf' \
  -F 'Format=json'

Notes

Troubleshooting

The REST API has throttling built in so you should check for 429 throttling errors.

Maintenance

Rebuild vendor directory with:

$ godep save ./...

More information on deploying Go on Heroku here:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL