Is there an ArcGIS REST API endpoint to view credit balance?

2486
1
05-31-2016 07:04 AM
KyleMagilavy
New Contributor

We'll be reaching out via the ArcGIS REST API to retrieve drive-time polygons as seen here:

ArcGIS REST API

Since these calls will cost ESRI creidts, I'd like to display our credit balance before we make the call so that we don't exceed our credits/know when we're low.

Is there a quick and dirty REST API url that we can hit to get our credit balance so I can show it to the user and let them decide if they want to execute?

Tags (1)
0 Kudos
1 Reply
nategunn
New Contributor

You *can* get the balance using the following form, but the lifespan of the token may be a problem:

1. Log into arcgisonline

2. Open your browser's development console, then refresh the page and watch your network tab.

3. Find the REST call tied to your credit lookup.  It should take the form:

http://<your_orgainization>.maps.arcgis.com/sharing/rest/portals/self?culture=en&f=json&token=<your_...

4. Reuse this call where you intend to do the actual credit check, and use the "availableCredits" key in the JSON response.

The tokens seem to expire quickly, so you may need to find a way to generate a longer lasting token.