var client = new RestClient("https://api.messageflow.com/v2.1/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "REPLACE_KEY_VALUE");
IRestResponse response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.messageflow.com/v2.1/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://api.messageflow.com/v2.1/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE")
.header("authorization", "REPLACE_KEY_VALUE")
.asString();
var request = require("request");
var options = {
method: 'GET',
url: 'https://api.messageflow.com/v2.1/email',
qs: {
offset: 'SOME_INTEGER_VALUE',
limit: 'SOME_INTEGER_VALUE',
smtpAccount: 'SOME_STRING_VALUE',
messageId: 'SOME_STRING_VALUE',
to: 'SOME_STRING_VALUE'
},
headers: {authorization: 'REPLACE_KEY_VALUE'}
};
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/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: REPLACE_KEY_VALUE"
),
));
$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/email"
querystring = {"offset":"SOME_INTEGER_VALUE","limit":"SOME_INTEGER_VALUE","smtpAccount":"SOME_STRING_VALUE","messageId":"SOME_STRING_VALUE","to":"SOME_STRING_VALUE"}
headers = {'authorization': 'REPLACE_KEY_VALUE'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.messageflow.com/v2.1/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["authorization"] = 'REPLACE_KEY_VALUE'
response = http.request(request)
puts response.read_body
http GET 'https://api.messageflow.com/v2.1/email?offset=SOME_INTEGER_VALUE&limit=SOME_INTEGER_VALUE&smtpAccount=SOME_STRING_VALUE&messageId=SOME_STRING_VALUE&to=SOME_STRING_VALUE' \
authorization:REPLACE_KEY_VALUEuthorization: REPLACE_KEY_VALUE'
var client = new RestClient("https://api.messageflow.com/v2.1/email");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "REPLACE_KEY_VALUE");
request.AddParameter("application/json", "{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}", 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/email"
payload := strings.NewReader("{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}")
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/email")
.header("content-type", "application/json")
.header("authorization", "REPLACE_KEY_VALUE")
.body("{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}")
.asString();
var request = require("request");
var options = {
method: 'POST',
url: 'https://api.messageflow.com/v2.1/email',
headers: {'content-type': 'application/json', authorization: 'REPLACE_KEY_VALUE'},
body: {
subject: 'Test email subject',
smtpAccount: '1.test.smtp',
tags: ['test-tag'],
content: {html: '<h1>Hello world</h1>', text: 'Hello world', templateId: 'as2sCwq'},
bcc: [{email: 'string', name: 'string'}],
cc: [{email: 'string', name: 'string'}],
from: {email: 'string', name: 'string'},
replyTo: {email: 'string', name: 'string'},
headers: {'X-TEST-HEADER': 'val'},
to: [
{
email: 'test@domena.pl',
name: 'Test sender',
messageId: 'test0001@domena.pl',
vars: {'test-var': 'var-value'}
}
],
attachments: [
{
fileName: 'report.txt',
fileMime: 'text/plain',
fileContent: 'c29tZSBmaWxlIGNvbnRlbnQ='
}
]
},
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/email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}",
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/email"
payload = "{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}"
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/email")
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 = "{\"subject\":\"Test email subject\",\"smtpAccount\":\"1.test.smtp\",\"tags\":[\"test-tag\"],\"content\":{\"html\":\"<h1>Hello world</h1>\",\"text\":\"Hello world\",\"templateId\":\"as2sCwq\"},\"bcc\":[{\"email\":\"string\",\"name\":\"string\"}],\"cc\":[{\"email\":\"string\",\"name\":\"string\"}],\"from\":{\"email\":\"string\",\"name\":\"string\"},\"replyTo\":{\"email\":\"string\",\"name\":\"string\"},\"headers\":{\"X-TEST-HEADER\":\"val\"},\"to\":[{\"email\":\"test@domena.pl\",\"name\":\"Test sender\",\"messageId\":\"test0001@domena.pl\",\"vars\":{\"test-var\":\"var-value\"}}],\"attachments\":[{\"fileName\":\"report.txt\",\"fileMime\":\"text/plain\",\"fileContent\":\"c29tZSBmaWxlIGNvbnRlbnQ=\"}]}"
response = http.request(request)
puts response.read_body
echo '{"subject":"Test email subject","smtpAccount":"1.test.smtp","tags":["test-tag"],"content":{"html":"<h1>Hello world</h1>","text":"Hello world","templateId":"as2sCwq"},"bcc":[{"email":"string","name":"string"}],"cc":[{"email":"string","name":"string"}],"from":{"email":"string","name":"string"},"replyTo":{"email":"string","name":"string"},"headers":{"X-TEST-HEADER":"val"},"to":[{"email":"test@domena.pl","name":"Test sender","messageId":"test0001@domena.pl","vars":{"test-var":"var-value"}}],"attachments":[{"fileName":"report.txt","fileMime":"text/plain","fileContent":"c29tZSBmaWxlIGNvbnRlbnQ="}]}' | \
http POST https://api.messageflow.com/v2.1/email \
authorization:REPLACE_KEY_VALUE \
content-type:application/jsonfileContent":"c29tZSBmaWxlIGNvbnRlbnQ="}]}'
Last updated