curl -X POST \
-H "Content-Type: application/json" \
-d '{"api_key":"00000000-0000-0000-0000-000000000000","label":"What is your hometown?","tag":"Hometown","type":"TEXT","fallback":"Unknown"}' \
https://emailoctopus.com/api/1.6/lists/00000000-0000-0000-0000-000000000000/fields
|
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://emailoctopus.com/api/1.6/lists/00000000-0000-0000-0000-000000000000/fields');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"api_key":"00000000-0000-0000-0000-000000000000","label":"What is your hometown?","tag":"Hometown","type":"TEXT","fallback":"Unknown"}');
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
|
import requests
headers = {
'Content-Type': 'application/json',
}
data = '{"api_key":"00000000-0000-0000-0000-000000000000","label":"What is your hometown?","tag":"Hometown","type":"TEXT","fallback":"Unknown"}'
response = requests.post('https://emailoctopus.com/api/1.6/lists/00000000-0000-0000-0000-000000000000/fields', headers=headers, data=data)
|
var https = require('https');
var postData = '{"api_key":"00000000-0000-0000-0000-000000000000","label":"What is your hometown?","tag":"Hometown","type":"TEXT","fallback":"Unknown"}';
var options = {
hostname: 'emailoctopus.com',
port: 443,
path: '/api/1.6/lists/00000000-0000-0000-0000-000000000000/fields',
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
var req = https.request(options);
req.write(postData);
req.end();
|
package main
import (
"io/ioutil"
"log"
"net/http"
"strings"
)
func main() {
client := &http.Client{}
var data = strings.NewReader(`{"api_key":"00000000-0000-0000-0000-000000000000","label":"What is your hometown?","tag":"Hometown","type":"TEXT","fallback":"Unknown"}`)
req, err := http.NewRequest("POST", "https://emailoctopus.com/api/1.6/lists/00000000-0000-0000-0000-000000000000/fields", data)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
}
|