Connecting to ReCharge's API for Subscription Data
Grow's REST API connector can seem a little confusing at times, but hopefully this post can help clear the air!
First of all, here is the API documentation: https://developer.rechargepayments.com/#introduction
You will need to request an access token to have access to these documents on their API. You can request it from Recharge and they'll send it to you.
Here is an example request that shows you how to authenticate your request from Recharge once you have that access token:
curl -i -H 'X-Recharge-Access-Token: your_api_token' \
-X GET https://api.rechargeapps.com
You can see that the way you're going to want to enter in this information in Grow's REST connecter goes as follows:
- Figure out the endpoint you want to query. For example, if you want a list of subscriptions from Recharge, you'll have to enter in this url: https://api.rechargeapps.com/subscriptions
- For the authentication header, you'll need to have the name be X-Recharge-Access-Token. The value of that header will be the token that you received from Recharge.
- Recharge limits the amount of objects that are returned in one call. They limit the rows to 250 per call. What this means is that you'll have to pass a 'page' parameter with the value being 1, 2, 3 to get more data. In Grow, you'll have to add more reports to add these different calls. This can eventually be unioned together in a Master SQL report to combine all the data, after which you can create a dataset using that Master SQL report as the primary report. (There are other ways to filter the data to give you what you want via other parameters. For more information on this consult the API documentation)
- For JSON arrays (the data that comes back from an API request), you'll usually have to define the path that Grow needs to take, or the array that you want Grow to open up. In this case, with the subscriptions endpoint, the JSON path to data is 'subscriptions'.
- Hit Get Data, and voila!
Although Grow doesn't actively support REST API connections, it can work and you can get your data in there. This is what we've found about Recharge and it does work! What we did was pulled around 20 different reports (for pagination) and then unioned all the data. Once we did that it seemed as easy as just querying it from the API normally.
Happy Growing!
Please sign in to leave a comment.
Comments
0 comments