var client = new RestClient("https://api.messageflow.com/v2.1/campaign/mail");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "REPLACE_KEY_VALUE");
request.AddParameter("application/json", "{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.messageflow.com/v2.1/campaign/mail"
payload := strings.NewReader("{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "REPLACE_KEY_VALUE")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.messageflow.com/v2.1/campaign/mail")
.header("content-type", "application/json")
.header("authorization", "REPLACE_KEY_VALUE")
.body("{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}")
.asString();
var request = require("request");
var options = {
method: 'POST',
url: 'https://api.messageflow.com/v2.1/campaign/mail',
headers: {'content-type': 'application/json', authorization: 'REPLACE_KEY_VALUE'},
body: {
campaignId: 'first-campaign-id',
name: 'firstCampaign',
description: 'My first campaign',
subject: 'Hello world',
fromName: 'John Doe',
fromAddress: 'john.doe@example.pl',
replyTo: 'john.doe@example.pl',
htmlFromWebSiteUrl: 'string',
htmlContent: '<h1> hello there</h1>',
textContent: 'hello there!',
groupId: 'test-group-id',
trackLinks: true,
googleAnalytics: true,
scheduleTime: '2020-09-10 10:15:00',
state: 'editable',
testAddresses: ['john.doe@example.pl'],
confirmationAddresses: ['john.doe@example.pl']
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.messageflow.com/v2.1/campaign/mail",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}",
CURLOPT_HTTPHEADER => array(
"authorization: REPLACE_KEY_VALUE",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.messageflow.com/v2.1/campaign/mail"
payload = "{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}"
headers = {
'content-type': "application/json",
'authorization': "REPLACE_KEY_VALUE"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.messageflow.com/v2.1/campaign/mail")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'REPLACE_KEY_VALUE'
request.body = "{\"campaignId\":\"first-campaign-id\",\"name\":\"firstCampaign\",\"description\":\"My first campaign\",\"subject\":\"Hello world\",\"fromName\":\"John Doe\",\"fromAddress\":\"john.doe@example.pl\",\"replyTo\":\"john.doe@example.pl\",\"htmlFromWebSiteUrl\":\"string\",\"htmlContent\":\"<h1> hello there</h1>\",\"textContent\":\"hello there!\",\"groupId\":\"test-group-id\",\"trackLinks\":true,\"googleAnalytics\":true,\"scheduleTime\":\"2020-09-10 10:15:00\",\"state\":\"editable\",\"testAddresses\":[\"john.doe@example.pl\"],\"confirmationAddresses\":[\"john.doe@example.pl\"]}"
response = http.request(request)
puts response.read_body
echo '{"campaignId":"first-campaign-id","name":"firstCampaign","description":"My first campaign","subject":"Hello world","fromName":"John Doe","fromAddress":"john.doe@example.pl","replyTo":"john.doe@example.pl","htmlFromWebSiteUrl":"string","htmlContent":"<h1> hello there</h1>","textContent":"hello there!","groupId":"test-group-id","trackLinks":true,"googleAnalytics":true,"scheduleTime":"2020-09-10 10:15:00","state":"editable","testAddresses":["john.doe@example.pl"],"confirmationAddresses":["john.doe@example.pl"]}' | \
http POST https://api.messageflow.com/v2.1/campaign/mail \
authorization:REPLACE_KEY_VALUE \
content-type:application/jsonrmationAddresses":["john.doe@example.pl"]}'
var client = new RestClient("https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D");
var request = new RestRequest(Method.PATCH);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "REPLACE_KEY_VALUE");
request.AddParameter("application/json", "{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D"
payload := strings.NewReader("{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "REPLACE_KEY_VALUE")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.patch("https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D")
.header("content-type", "application/json")
.header("authorization", "REPLACE_KEY_VALUE")
.body("{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}")
.asString();
var request = require("request");
var options = {
method: 'PATCH',
url: 'https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D',
headers: {'content-type': 'application/json', authorization: 'REPLACE_KEY_VALUE'},
body: {
state: 'sendable',
scheduleTime: '2020-09-10 10:15:00',
testAddresses: ['john.doe@example.pl']
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}",
CURLOPT_HTTPHEADER => array(
"authorization: REPLACE_KEY_VALUE",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D"
payload = "{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}"
headers = {
'content-type': "application/json",
'authorization': "REPLACE_KEY_VALUE"
}
response = requests.request("PATCH", url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'REPLACE_KEY_VALUE'
request.body = "{\"state\":\"sendable\",\"scheduleTime\":\"2020-09-10 10:15:00\",\"testAddresses\":[\"john.doe@example.pl\"]}"
response = http.request(request)
puts response.read_body
echo '{"state":"sendable","scheduleTime":"2020-09-10 10:15:00","testAddresses":["john.doe@example.pl"]}' | \
http PATCH https://api.messageflow.com/v2.1/campaign/mail/%7BcampaignId%7D \
authorization:REPLACE_KEY_VALUE \
content-type:application/json","testAddresses":["john.doe@example.pl"]}'
Last updated