GET - Get campaign stats
The stats endpoint allows you to track the result of any existing campaign using its token number.
Request structure
Route
The campaigns API exposes a GET endpoint at: https://api.batch.com/1.1/BATCH_API_KEY/campaigns/stats/CAMPAIGN_TOKEN
Here are examples of valid cURL, PHP or Python requests syntax:
The BATCH_API_KEY
value is your Live Batch API key from the settings page of your app within the dashboard (Settings → General). Only LIVE API Keys are supported by this API.
The CAMPAIGN_TOKEN
value is the token you receive when you successfully create a push campaign using the API.
Headers
In order to authenticate with the API, you need to provide your company REST API Key as the value of the X-Authorization
header. You can find it in ⚙ Settings → General.
Responses
Success
If the GET to the API endpoint is successfull you will receive an HTTP 200 confirmation and information on your campaign.
Here is how it looks for an A/B test campaign:
You can use this information to show the results of your campaigns in your business intelligence tools.
Also, you can easily calculate the open-rate by using the following formula:
open-rate = (direct_open
+ influenced_open
) / sent
Failure
If the GET data does not meet the API requirements you will receive an actionable error message. Contact us at [email protected] if you need further support.
AUTHENTICATION_INVALID
(Http status code: 401, Error code: 10)API_MISUSE
(Http status code: 403, Error code: 12)ROUTE_NOT_FOUND
(Http status code: 404, Error code: 20)SERVER_ERROR
(Http status code: 500, Error code: 0)TOO_MANY_REQUESTS
(Http status code: 429, Error code: 60) If you get a "too many requests" response, please wait for at least 5 seconds before trying again. Further requests might still return this error.
Last updated
Was this helpful?