Get Campaign
curl --request GET \
--url https://campaignservice-staging.withbenji.com/campaigns/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://campaignservice-staging.withbenji.com/campaigns/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://campaignservice-staging.withbenji.com/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://campaignservice-staging.withbenji.com/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://campaignservice-staging.withbenji.com/campaigns/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://campaignservice-staging.withbenji.com/campaigns/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://campaignservice-staging.withbenji.com/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"campaign": {
"base_reward": 1,
"campaign_logo": "testcampaign.png",
"campaign_type": 1,
"created_date": "2024-11-20T00:30:57.256493+00:00",
"description": "This is a test campaign",
"end_date": null,
"id": 1,
"is_active": 1,
"is_deleted": 0,
"merchant_id": 1,
"name": "Test Campaign",
"owner_id": 5,
"partner_id": 3,
"start_date": "2024-11-14T03:18:06+00:00",
"total_rewards": 100,
"trigger_type": 1
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "campaign_does_not_exist",
"message": "The campaign does not exist"
}
Get Campaign
Endpoint to retrieve campaign basic data
GET
/
campaigns
/
{id}
Get Campaign
curl --request GET \
--url https://campaignservice-staging.withbenji.com/campaigns/{id} \
--header 'x-api-key: <api-key>'import requests
url = "https://campaignservice-staging.withbenji.com/campaigns/{id}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://campaignservice-staging.withbenji.com/campaigns/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://campaignservice-staging.withbenji.com/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://campaignservice-staging.withbenji.com/campaigns/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://campaignservice-staging.withbenji.com/campaigns/{id}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://campaignservice-staging.withbenji.com/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "ok",
"data": {
"campaign": {
"base_reward": 1,
"campaign_logo": "testcampaign.png",
"campaign_type": 1,
"created_date": "2024-11-20T00:30:57.256493+00:00",
"description": "This is a test campaign",
"end_date": null,
"id": 1,
"is_active": 1,
"is_deleted": 0,
"merchant_id": 1,
"name": "Test Campaign",
"owner_id": 5,
"partner_id": 3,
"start_date": "2024-11-14T03:18:06+00:00",
"total_rewards": 100,
"trigger_type": 1
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "campaign_does_not_exist",
"message": "The campaign does not exist"
}
The
x-api-key header value to be used on this API is your partner API key, which can be generated through the dashboard.integer
required
The Benji Platform ID of the campaign
Return values
object
A campaign object property
Hide properties
Hide properties
integer
Benji Platform campaign identifier
string
The campaign display name as configured on the Benji Platform
string
The campaign’s description as configured on the Benji platform
string
URL of a marketing logo associated with the campaign
integer
Integer representing an enum of one of the following campaign type values:
Show possible campaign type values
Show possible campaign type values
- EARN (1) : Indicating an earn rewards campaign type
- REDEEM (2) : Indicating a redeem rewards campaign type
- CONNECT_ONLY (3) : Indicating a status sharing campaign with no ability to earn or redeem rewards
integer
Integer representing an enum of one of the following campaign trigger values:
Show possible trigger type values
Show possible trigger type values
- SPEND (1) : Indicating a campaign triggered on a transaction
- REGISTRATION (2) : Indicating a campaign triggered on a new user registration
- REFERRAL (3) : Indicating a campaign triggered on a successful user referral action
- CUSTOM (4) : Indicating a campaign triggered by a custom action
integer
The ID of the merchant partner associated with this campaign in the Benji Platform
integer
The ID of the partner associated with this campaign in the Benji Platform
integer
The base reward conversion rate for earn and redeem type campaigns
datetime
The date this campaign will go live
datetime
The date this campaign will end
integer
The total amount of rewards earned or redeemed through this campaign
integer
Integer indicating if this campaign has been activated, 1 specifying active and 0 specifying not active
{
"code": "ok",
"data": {
"campaign": {
"base_reward": 1,
"campaign_logo": "testcampaign.png",
"campaign_type": 1,
"created_date": "2024-11-20T00:30:57.256493+00:00",
"description": "This is a test campaign",
"end_date": null,
"id": 1,
"is_active": 1,
"is_deleted": 0,
"merchant_id": 1,
"name": "Test Campaign",
"owner_id": 5,
"partner_id": 3,
"start_date": "2024-11-14T03:18:06+00:00",
"total_rewards": 100,
"trigger_type": 1
}
}
}
{
"error": "invalid_token",
"message": "Invalid token"
}
{
"error": "unauthorized_request",
"message": "Token is not authorized to make this request"
}
{
"error": "campaign_does_not_exist",
"message": "The campaign does not exist"
}
Note that you will only receive data that you as a loyalty partner or merchant partner are allowed to see based on the permissions in the access token you provide to the API.
Was this page helpful?
⌘I