SDK
import { createVoyantStorefrontClient } from "@voyant-travel/storefront-sdk";
const voyant = createVoyantStorefrontClient({ baseUrl: "https://app.example.com" });
await voyant.storefront.subscribeNewsletter({
"email": "<string>",
"consent": true,
"locale": "<string>"
});curl --request POST \
--url https://app.example.com/v1/public/newsletter/subscribe \
--header 'Content-Type: application/json' \
--data '{
"email": "<string>",
"consent": true,
"locale": "<string>"
}'const response = await fetch("https://app.example.com/v1/public/newsletter/subscribe", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "<string>",
"consent": true,
"locale": "<string>"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://app.example.com/v1/public/newsletter/subscribe",
json={
"email": "<string>",
"consent": True,
"locale": "<string>"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/public/newsletter/subscribe",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'jsmith@example.com',
'consent' => true,
'locale' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://{operatorDomain}/v1/public/newsletter/subscribe"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://{operatorDomain}/v1/public/newsletter/subscribe")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/public/newsletter/subscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"status": "pending_double_opt_in"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}Operator profile
Subscribe to newsletter
Subscribe an email to the newsletter with consent tracking.
POST
/
v1
/
public
/
newsletter
/
subscribe
SDK
import { createVoyantStorefrontClient } from "@voyant-travel/storefront-sdk";
const voyant = createVoyantStorefrontClient({ baseUrl: "https://app.example.com" });
await voyant.storefront.subscribeNewsletter({
"email": "<string>",
"consent": true,
"locale": "<string>"
});curl --request POST \
--url https://app.example.com/v1/public/newsletter/subscribe \
--header 'Content-Type: application/json' \
--data '{
"email": "<string>",
"consent": true,
"locale": "<string>"
}'const response = await fetch("https://app.example.com/v1/public/newsletter/subscribe", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "<string>",
"consent": true,
"locale": "<string>"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://app.example.com/v1/public/newsletter/subscribe",
json={
"email": "<string>",
"consent": True,
"locale": "<string>"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/public/newsletter/subscribe",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'jsmith@example.com',
'consent' => true,
'locale' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://{operatorDomain}/v1/public/newsletter/subscribe"
payload := strings.NewReader("{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://{operatorDomain}/v1/public/newsletter/subscribe")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/public/newsletter/subscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jsmith@example.com\",\n \"consent\": true,\n \"locale\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"status": "pending_double_opt_in"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}⌘I