Overview

School administrators are welcome to automate common tasks through our Web API. Examples of tasks that you may want to consider the API for include:

  • Automating updates between Student Information System and PushCoin.
  • Downloading sale transactions or revenue data into a third-party accounting system.
  • Generating reports or carrying out statistical analysis in an external tool like R or Excel.
  • Submitting deposits, withdrawals or refunds from another application developed in-house.

Getting started: obtaining the Access Key

To use the Web API, you first must obtain the Access Key which serves as an authentication token. This token must accompany every API request that you will submit.

Warning: Always safeguard your Access Key. If the key leaks, depending on the role assigned to the key owner, it may be used to submit unauthorized deposits or make modifications to student profiles.

To generate the Access Key, login to PushCoin with Administrator rights. From the top menu, choose Clerks, then Add Clerk and fill out the form. We recommend naming the new user “Web API” in place of first and last names. Assign a role to the new user with minimum rights. Click Submit when done.

On the following screen, choose the Web API-user from the list of users. Click the Generate button and save the Secret Key that you have been provided. You are ready to make API calls.

Sending requests to PushCoin

The Access Key obtained earlier allows you to send web requests from virtually unlimited languages and OS environments. Curl is a simple command-line utility familiar to Mac and Linux users. We will use it to demonstrate sending requests to PushCoin servers. Curl is also available for Windows, however if you would rather use PowerShell to send requests in Windows, look at Invoke-WebRequest available since version 3 of PowerShell.

Here is a simple HTTP GET request to list deposits made between 2015-04-28 and 2015-05-11:

curl "https://api.pushcoin.com/api/v1/guest/reports/deposits?start_date=2015-04-28&end_date=2015-05-11" -H "Authorization: Bearer <Access-Key>"

Remember to substitute <Access Key> with the actual key obtained earlier.

If the web request completed successfully and there were deposits made during the period specified in your query, you will see a JSON result like this:

{
 "resource": "reports/deposits",
 "response": [
 {
 "cus_ext_id": "123-332123",
 "cus_id": "f345dffds",
 "cus_nm": "Lebowski, Andrew",
 "cus_org_unit": "GHS",
 "fnd_src_ty": "Card",
 "tx_amt": 35,
 "tx_ctx": "D",
 "tx_id": "HTTYL5N5FPL",
 "tx_nte": "John Doe, Card, Visa, **22, 123456",
 "tx_tm": "2015-05-05T19:01:41Z"
 },
 {
 "cus_ext_id": "2231235",
 "cus_id": "fds3523fds",
 "cus_nm": "Tucher, Carolina",
 "cus_org_unit": "GHS",
 "cus_tle": "2nd Grade",
 "fnd_src_ty": "Card",
 "tx_amt": 35,
 "tx_ctx": "D",
 "tx_id": "TAfX57L",
 "tx_nte": "John Doe, Card, Visa, **22, 123456",
 "tx_tm": "2015-05-04T20:38:30Z"
 }
 ],
 "schema": "pushcoin:reply.1",
 "status": 200,
 "text": "Success"
 }

Next step…

Read here how to automate the task of keeping PushCoin student information up to date.

Tagged: