For the complete documentation index, see llms.txt. This page is also available as Markdown.

/api/mailing/mailing

get

Get mailing details

Authorizations
api-keystringRequired
api-usernamestringRequired
Query parameters
mailidintegerRequiredDefault: --broken--
decodestringOptionalDefault: 0
Responses
200

success

successbooleanOptionalExample: true
get/api/mailing/mailing
PHP (cURL)
<?php

$headers = array( //set your username and API key here
	'api-key: 44b5498dbcb481a0d00b404c0169af62',
	'api-username: tmm1phrvezsbu'
);
$url = 'https://yourdomain.com'; //set your NATS URL here

$data = array(
		'mailid' => 1,
		'decode' => 0
	);

$request = array(
	'method' => 'GET',
	'path' => 'mailing/mailing',
	'data' => $data
);

/*code below is the same for (almost) every API call */

$curl = curl_init();

$url = $url.'/api/'.$request['path'];

$query = http_build_query($request['data']);

if($request['method'] == 'GET'){
	//add query string parameters to the end of the url
	$url = $url.'?'.$query;
}else{
	//send parameters as POST fields
	curl_setopt($curl, CURLOPT_POST, 1);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $query);

	if($request['method'] != 'POST'){
		$headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method
	}
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);


$resp = curl_exec($curl);
//dumps an associative array representation of the json
var_dump(json_decode($resp, true));
// Close request to clear up some resources
curl_close($curl);
?>
200

success

{
  "success": true,
  "mail": {
    "added": "1565382548",
    "added_nice": "2019-08-09 16:29:08",
    "body": null,
    "body_html": null,
    "deleted": "0",
    "email_once": "0",
    "enabled": "0",
    "first_send_end": "0",
    "first_send_end_nice": "Never",
    "first_send_start": "0",
    "first_send_start_nice": "Never",
    "last_send_end": "0",
    "last_send_end_nice": "Never",
    "last_send_start": "0",
    "last_send_start_nice": "Never",
    "mail_type_id": "0",
    "mailid": "1",
    "only_once": "0",
    "send_count": "0",
    "send_detail": "",
    "send_nice": "Never",
    "send_on": "1",
    "send_on_nice": "Never",
    "send_type": "never",
    "status": 0,
    "status_nice": "unscheduled",
    "subject": "subject test",
    "total_send_count": "0",
    "type_nice": "Affiliates"
  }
}
post

Add new mailing

Authorizations
api-keystringRequired
api-usernamestringRequired
Query parameters
subjectstringRequired
typestringOptional
send_onstringRequired
Responses
200

success

successbooleanOptionalExample: true
post/api/mailing/mailing
PHP (cURL)
<?php

$headers = array( //set your username and API key here
	'api-key: 44b5498dbcb481a0d00b404c0169af62',
	'api-username: tmm1phrvezsbu'
);
$url = 'https://yourdomain.com'; //set your NATS URL here

$data = array(
		'subject' => 'subject test',
		'type' => true,
		'send_on' => 'never'
	);

$request = array(
	'method' => 'POST',
	'path' => 'mailing/mailing',
	'data' => $data
);

/*code below is the same for (almost) every API call */

$curl = curl_init();

$url = $url.'/api/'.$request['path'];

$query = http_build_query($request['data']);

if($request['method'] == 'GET'){
	//add query string parameters to the end of the url
	$url = $url.'?'.$query;
}else{
	//send parameters as POST fields
	curl_setopt($curl, CURLOPT_POST, 1);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $query);

	if($request['method'] != 'POST'){
		$headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method
	}
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);


$resp = curl_exec($curl);
//dumps an associative array representation of the json
var_dump(json_decode($resp, true));
// Close request to clear up some resources
curl_close($curl);
?>
200

success

{
  "success": true,
  "result": "Mailing added",
  "mailid": 1
}
delete

Delete maling

Authorizations
api-keystringRequired
api-usernamestringRequired
Query parameters
mailidintegerRequired
Responses
200

success

successbooleanOptionalExample: true
delete/api/mailing/mailing
PHP (cURL)
<?php

$headers = array( //set your username and API key here
	'api-key: 44b5498dbcb481a0d00b404c0169af62',
	'api-username: tmm1phrvezsbu'
);
$url = 'https://yourdomain.com'; //set your NATS URL here

$data = array(
		'mailid' => 1
	);

$request = array(
	'method' => 'DELETE',
	'path' => 'mailing/mailing',
	'data' => $data
);

/*code below is the same for (almost) every API call */

$curl = curl_init();

$url = $url.'/api/'.$request['path'];

$query = http_build_query($request['data']);

if($request['method'] == 'GET'){
	//add query string parameters to the end of the url
	$url = $url.'?'.$query;
}else{
	//send parameters as POST fields
	curl_setopt($curl, CURLOPT_POST, 1);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $query);

	if($request['method'] != 'POST'){
		$headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method
	}
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);


$resp = curl_exec($curl);
//dumps an associative array representation of the json
var_dump(json_decode($resp, true));
// Close request to clear up some resources
curl_close($curl);
?>
200

success

{
  "success": true,
  "result": "mailing deleted"
}
patch

Edit mailing

Authorizations
api-keystringRequired
api-usernamestringRequired
Query parameters
mailidintegerRequired
subjectstringOptional
only_oncestringOptional
email_oncestringOptional
send_onstringOptional
bodystringOptional
body_htmlstringOptional
Responses
200

success

successbooleanOptionalExample: true
patch/api/mailing/mailing
PHP (cURL)
<?php

$headers = array( //set your username and API key here
	'api-key: 44b5498dbcb481a0d00b404c0169af62',
	'api-username: tmm1phrvezsbu'
);
$url = 'https://yourdomain.com'; //set your NATS URL here

$data = array(
		'mailid' => 1,
		'subject' => 'updated mail subject',
		'only_once' => 1,
		'email_once' => 1,
		'body' => 'updated mail body'
	);

$request = array(
	'method' => 'PATCH',
	'path' => 'mailing/mailing',
	'data' => $data
);

/*code below is the same for (almost) every API call */

$curl = curl_init();

$url = $url.'/api/'.$request['path'];

$query = http_build_query($request['data']);

if($request['method'] == 'GET'){
	//add query string parameters to the end of the url
	$url = $url.'?'.$query;
}else{
	//send parameters as POST fields
	curl_setopt($curl, CURLOPT_POST, 1);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $query);

	if($request['method'] != 'POST'){
		$headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method
	}
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);


$resp = curl_exec($curl);
//dumps an associative array representation of the json
var_dump(json_decode($resp, true));
// Close request to clear up some resources
curl_close($curl);
?>
200

success

{
  "success": true,
  "result": "mailing updated"
}

Last updated

Was this helpful?