Update campaign
curl --request PUT \
--url https://{domain}/api/v2/network/campaigns/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Updated Campaign",
"commission_plan_id": 2,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": null,
"status": "active"
}
'import requests
url = "https://{domain}/api/v2/network/campaigns/{id}"
payload = {
"name": "Updated Campaign",
"commission_plan_id": 2,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": None,
"status": "active"
}
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: 'Updated Campaign',
commission_plan_id: 2,
traffic_source_id: 1,
landing_page_id: 1,
creative_id: null,
status: 'active'
})
};
fetch('https://{domain}/api/v2/network/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/network/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' => 'Updated Campaign',
'commission_plan_id' => 2,
'traffic_source_id' => 1,
'landing_page_id' => 1,
'creative_id' => null,
'status' => 'active'
]),
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/network/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\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/network/campaigns/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/network/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\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"name": "OK",
"message": "Campaign updated",
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"status": "active",
"created": 123,
"date_added": 123,
"date_updated": 123,
"offer": {
"id": 123,
"title": "<string>",
"image": "<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>"
}
}
}
}{
"status": "error",
"code": 422,
"name": "Unprocessable entity",
"message": "<string>",
"info": {
"errors": {}
}
}Campaigns
Update campaign
Updates mutable fields of the specified campaign. offer_id, affiliate_id, and hash are immutable and silently ignored if sent.
PUT
/
api
/
v2
/
network
/
campaigns
/
{id}
Update campaign
curl --request PUT \
--url https://{domain}/api/v2/network/campaigns/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Updated Campaign",
"commission_plan_id": 2,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": null,
"status": "active"
}
'import requests
url = "https://{domain}/api/v2/network/campaigns/{id}"
payload = {
"name": "Updated Campaign",
"commission_plan_id": 2,
"traffic_source_id": 1,
"landing_page_id": 1,
"creative_id": None,
"status": "active"
}
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: 'Updated Campaign',
commission_plan_id: 2,
traffic_source_id: 1,
landing_page_id: 1,
creative_id: null,
status: 'active'
})
};
fetch('https://{domain}/api/v2/network/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/network/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' => 'Updated Campaign',
'commission_plan_id' => 2,
'traffic_source_id' => 1,
'landing_page_id' => 1,
'creative_id' => null,
'status' => 'active'
]),
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/network/campaigns/{id}"
payload := strings.NewReader("{\n \"name\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\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/network/campaigns/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/network/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\": \"Updated Campaign\",\n \"commission_plan_id\": 2,\n \"traffic_source_id\": 1,\n \"landing_page_id\": 1,\n \"creative_id\": null,\n \"status\": \"active\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"name": "OK",
"message": "Campaign updated",
"info": {
"campaign": {
"id": 123,
"hash": "<string>",
"name": "<string>",
"status": "active",
"created": 123,
"date_added": 123,
"date_updated": 123,
"offer": {
"id": 123,
"title": "<string>",
"image": "<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>"
}
}
}
}{
"status": "error",
"code": 422,
"name": "Unprocessable entity",
"message": "<string>",
"info": {
"errors": {}
}
}Authorizations
ApiKeyHeaderAuthApiKeyAuth
Body
application/json
Was this page helpful?