Refersion offers a GraphQL API which allows Marketplace affiliates to fetch performance data from any of the brands they promote within the Refersion Marketplace.
What is GraphQL?
GraphQL is a query language used to obtain information from an API. Unlike a REST API where you make multiple requests to different endpoints (URLs), GraphQL makes it easy to get the exact information you’re looking for from your Marketplace account in a single API request.
Obtaining your GraphQL token from your Marketplace account
Before you start using GraphQL with your Refersion Marketplace account, you’ll need to generate a GraphQL token. To do this, login to your Refersion Marketplace account, click your name on the top right corner to reveal a dropdown, and then click Edit Your Profile.
Within your profile, scroll towards the bottom to find the Your GraphQL Token section. Click Generate New Token.
You’ll need this GraphQL token when authorizing any requests to Refersion’s GraphQL API. This token may also be required for integrating with some of our integration partners.
What information can I get from GraphQL?
GraphQL will let you access information about conversions, clicks, payments, and more. Using an external tool like GraphQL Voyager, you’ll be able to pull up a mapping of all available fields.
If you’d like to use GraphQL Voyager, follow these instructions to obtain an introspection query to use within Voyager. Once you have the query, paste it in the introspection box and click Display.
Once that’s complete, you’ll see a graph similar to the image below.
In the above image, each table contains specific fields that can be queried in GraphQL to obtain information about your Marketplace account. The lines show how the individual tables are connected to each other.
For example, as an affiliate, you can query for information about yourself from the Affiliate table and also query for information from the Conversion Triggers table to see which triggers are associated with your account.
How do I use GraphQL?
There are a couple of ways to use GraphQL:
Use a REST API testing tool
Integrate GraphQL into your code (advanced - requires knowledge of code)
Use a REST API testing tool
A REST API testing tool provides a user-friendly interface for sending requests to any API. If you’d like to play around with GraphQL and see what data is available, or just learn more about how it works, you can use one of the following tools:
Here’s an example GraphQL query using Insomnia:
You can check out more example queries here.
Integrate GraphQL with one of our Partners (Affluent or Affilimate)
If the goal of using the GraphQL API is to route data into another platform to optimize performance or aggregate analytics across different networks, Refersion works with partners like Affluent and Affilimate who specialize in this type of data aggregation.
Both platforms provide unified reporting and other features for conversion optimization and tracking. To integrate with either platform, sign up and follow their instructions for integrating Refersion:
Integrate GraphQL into your code (advanced)
If you are looking to do a deep data integration with Refersion, you can integrate the GraphQL API directly into your code. We won’t cover how to do that here; however, here is an article that might be useful.