Reports via REST API

Follow

Need to automate your reports into your BI software, or simply pull your reports outside of LeadByte?

Our reports via REST API may be what you're looking for.

You are able to make a GET request to LeadByte and receive all your campaign data in a JSON format.

 

Getting started

To begin with, you'll need a administrator REST API key with the "reports" permission checked.

As with all API keys, make sure it is activated and saved before using.

 

Calling the REST API

Now you have a REST API key with the correct permissions you'll need to make the REST API call to LeadByte. On your REST API settings, scroll down the bottom of the page and you'll see a group of expandable report choices:

Image_2020-07-31_at_11.11.35_AM.png

Expand one of these for instructions on how to call the REST API for each of the reports.

 

Things you might need

When LeadByte is asking for a campaign ID or a responder ID, it is referring to the database ID. You can find this by editing your campaign and checking the URL. In my example below, I would use the ID 9:

Image_2020-07-31_at_11.24.25_AM.png

 

Example call

I'm looking to pull a campaign summary report for my example campaign for the month of July.

Below is what I would call LeadByte with:

http://YOURDOMAIN.leadbyte.com/restapi/v1.2/reports/campaign?key=abc123456abcdef&campaignId=9&from=2020-07-01T00:00:00Z&to=2020-07-31T00:00:00Z

 

The response received back (once beautified) would look like this:

{
"status": "Success",
"message": "OK",
"data": [
{
"campaign": {
"id": "9",
"name": "Example Campaign",
"reference": "EXAMPLE-CAMPAIGN"
},
"leads": 82,
"valid": 74,
"invalid": 8,
"pending": 0,
"rejections": 63,
"approved": 11,
"returns": 0,
"supplierCost": 37.5,
"emailCost": 0,
"smsCost": 0.026,
"validationCost": 0.0255,
"revenue": 250,
"profit": 212.4485,
"currency": "GBP"
}
]
}

Obviously this call and response will change for each report you pull, however the format will always be:

Call to LeadByte > GET

Response back from LeadByte > JSON

Was this article helpful?
0 out of 0 found this helpful

Comments