As a part of the onboarding process, an ad-tech company needed to know how much their new signups earned on various ad networks. This helps them verify the customers' size and tailor their tutorial to features that would be most relevant.
They were able to use WrapAPI to create a single-API-call integration in just one hour.
CJ (formerly Commission Junction) is one of the world's largest affiliate advertising networks, and as a result, many of the ad-tech company's clients were also publishers with CJ. However, CJ's APIs didn't have the needed functionality: it only provides a single endpoint to get past commissions, which only returns up to 30 days of data at a time.
Using WrapAPI, the company's engineers created a single API call would authenticate a user, get account information, and retrieve commissions data that they then called from their application. This took less than an hour of engineering time, and boosted the number of their users who chose to connect their CJ account and their long-term retention/engagement.
The endpoint that the company ends up calling from their application code is the chained-together cj/performanceReportComposite
endpoint. This API endpoint uses WrapAPI's composition functionality to glue together multiple requests, so that cookies and data from previous requests are passed on to later ones.
Behind the scenes, this endpoint 1) logs the user in, 2) gets their company ID, and then 3) gets the company's commissions (performance report).
Backing URL | https:/ |
Description | Signs in for a publisher to CJ. It also returns the cookies in the form of a "state token" that represents the signed-in user. This state token can then be passed to any other WrapAPI API endpoint. |
{
"username": "your@email.com",
"password": "YOUR_PASSWORD_HERE"
}
{
"success": true,
"outputScenario": "success",
"data": {
"publisherId": "3827697"
},
"stateToken": "eyJqYXIiOnsidmVyc2lvbiI6InRvdWdoLWNv...="
}
Backing URL | https:/ |
Description | In order to get a commissions report, we need to know the company ID, not just the user ID. This API call returns the company ID from a CJ API endpoint that requires authentication. |
{
// Both from cj/login
stateToken: 'eyJqYXIi...=',
publisherId: '1234567'
}
{
"success": true,
"outputScenario": "success",
"data": {
"data": {
"userCompanyId": 1234568,
"companyName": "Blah Inc.",
...
}
},
"stateToken": "eyJqYXIiOnsidmVyc2lv...",
}
Backing URL | https:/ |
Description | Gets the performance (commissions) report for a given company's websites. This is the data the company was looking for, and the other chained API endpoints just get the cookies and company ID needed for this. |
{
"companyId": 1234568,
"startDate": "2016-12-25",
"endDate": "2017-01-25",
"stateToken": "eyJqYXIiOnsidmVyc2lv...",
}
{
"success": true,
"outputScenario": "success",
"data": {
"data": [
{
"period": "01/25/2017 00:00:00 UTC-0800",
"website": "A Website",
"websiteId": 1424397,
"publisherCommission": "61.950",
"saleAmount": "8462.290",
...
}
]
}
}