Create Campaign

This endpoint is used to create campaign. The request method of this call needs to be "POST".


https://api2.pushassist.com/campaigns/


Parameter Name Description
title Campaign title.
message Campaign message
redirect_url Target url to be associated with the Campaign (Optional).
timezone Campaign timezone (YYYY-MM-DD HH:MM:SS).
image https:// OR http://target-url image (250px X 250px) (Optional).
big_image https:// OR http://target-url image (400px X 400px) (Optional).
Example
 function add_campaigns($response_array){
				
	$url = 'https://api2.pushassist.com/campaigns/';     		
	
	$headers = array(
		'X-Auth-Token: Your API Key',
		'X-Auth-Secret: Your SECRET Key',
		'Content-Type: application/json'
	);
   
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($response_array));
	curl_setopt($ch, CURLOPT_SSLVERSION, 4);
	$result = curl_exec($ch);

	if ($result === FALSE) {
		die('Curl failed: ' . curl_error($ch));
	}
	
	curl_close($ch);

	$result_arr = json_decode($result, true);
	
	return $result_arr;
}
Request Array
$response_array = array("campaign" => array(
	"title"=> "API TEST campaign",
	"message"=> "Hello API Calling campaign",
	"redirect_url"=> "",
	"timezone" => "2016-8-11 01:15:20",
	"image"=> "",//Image Path // local path will not work 250X250
	"big_image"=> ""),//Image Path // local path will not work	400X400
	"utm_params" => array("utm_source" => "",
		"utm_medium" => "",
		"utm_campaign" => ""),
	"segments" => array()	// if segment selected send selected segment value else pass empty array
	);

$response = add_campaigns($response_array);
Response
if($response['status'] == 'Success'){

	echo $response['response_message'];

} else if($response['status'] == 'Error') {

	echo $response['error_message'];

} else {

	echo $response['errors'];
}