Update affiliate campaign
curl --request PUT \
--url https://{domain}/api/v2/affiliate/campaigns/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Sample",
"commission_plan_id": 1,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": null
}
'import requests
url = "https://{domain}/api/v2/affiliate/campaigns/{id}"
payload = {
"name": "Sample",
"commission_plan_id": 1,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": None
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sample',
commission_plan_id: 1,
traffic_source_id: 1,
landing_page_id: 1,
creative_id: null
})
};
fetch('https://{domain}/api/v2/affiliate/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://{domain}/api/v2/affiliate/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Sample',
'commission_plan_id' => 1,
'traffic_source_id' => 1,
'landing_page_id' => 1,
'creative_id' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/v2/affiliate/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{domain}/api/v2/affiliate/campaigns/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/affiliate/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}"
response = http.request(request)
puts response.read_body{
"message": "Campaign updated",
"success": true,
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"created": 123,
"date_added": 123,
"date_updated": 123,
"countries": [
{
"id": 123,
"title": "<string>",
"code": "<string>"
}
],
"offer": {
"id": 123,
"title": "<string>"
},
"affiliate": {
"id": 123,
"title": "<string>"
},
"advertiser": {
"id": 123,
"title": "<string>"
},
"commission_plan": {
"id": 123,
"title": "<string>"
},
"traffic_source": {
"id": 123,
"title": "<string>"
},
"traffic_approach": {
"id": 123,
"title": "<string>"
},
"landing_page": {
"id": 123,
"title": "<string>",
"offer_id": 123
},
"creative": {
"id": 123,
"title": "<string>"
}
}
}
}{
"message": "<string>",
"success": false,
"info": {
"errors": {}
}
}Campaigns
Update affiliate campaign
Updates mutable campaign fields. offer_id, hash, and affiliate_id are immutable and silently ignored if sent.
PUT
/
api
/
v2
/
affiliate
/
campaigns
/
{id}
Update affiliate campaign
curl --request PUT \
--url https://{domain}/api/v2/affiliate/campaigns/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Sample",
"commission_plan_id": 1,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": null
}
'import requests
url = "https://{domain}/api/v2/affiliate/campaigns/{id}"
payload = {
"name": "Sample",
"commission_plan_id": 1,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": None
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sample',
commission_plan_id: 1,
traffic_source_id: 1,
landing_page_id: 1,
creative_id: null
})
};
fetch('https://{domain}/api/v2/affiliate/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://{domain}/api/v2/affiliate/campaigns/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Sample',
'commission_plan_id' => 1,
'traffic_source_id' => 1,
'landing_page_id' => 1,
'creative_id' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/v2/affiliate/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{domain}/api/v2/affiliate/campaigns/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/affiliate/campaigns/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sample\",\n \"commission_plan_id\": 1,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null\n}"
response = http.request(request)
puts response.read_body{
"message": "Campaign updated",
"success": true,
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"created": 123,
"date_added": 123,
"date_updated": 123,
"countries": [
{
"id": 123,
"title": "<string>",
"code": "<string>"
}
],
"offer": {
"id": 123,
"title": "<string>"
},
"affiliate": {
"id": 123,
"title": "<string>"
},
"advertiser": {
"id": 123,
"title": "<string>"
},
"commission_plan": {
"id": 123,
"title": "<string>"
},
"traffic_source": {
"id": 123,
"title": "<string>"
},
"traffic_approach": {
"id": 123,
"title": "<string>"
},
"landing_page": {
"id": 123,
"title": "<string>",
"offer_id": 123
},
"creative": {
"id": 123,
"title": "<string>"
}
}
}
}{
"message": "<string>",
"success": false,
"info": {
"errors": {}
}
}Authorizations
ApiKeyHeaderAuthApiKeyAuth
Preferred authentication method. Pass the API key in the X-API-Key HTTP request header. The user account must have api_status enabled.
Path Parameters
Campaign ID.
Body
application/json
Campaign name. Maximum 100 characters.
Commission plan ID bound to the offer.
Traffic source ID.
Traffic approach ID.
Landing page ID bound to the offer.
Optional creative ID, or null to remove.
Campaign status.
Available options:
active, paused GeoNames country IDs. Pass an empty array to remove all country restrictions.
Was this page helpful?
⌘I