cURL
curl "https://app.tatango.com/api/v2/lists/<ID>/custom_field" -d '{"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-u emailaddress@mydomain.com:my_api_key \
-H "Host: example.org" \
-H "Cookie: "require 'net/http'
require 'uri'
uri = URI.parse('https://app.tatango.com/api/v2/lists/<ID>/custom_field')
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_url)
request.basic_auth("emailaddress@mydomain.com", "my_api_key")
request.body = {"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}}.to_json
response = http.request(request)var request = new XMLHttpRequest();
request.open('POST', 'https://app.tatango.com/api/v2/lists/<ID>/custom_field', false);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Basic ' + btoa('emailaddress@mydomain.com:my_api_key'));
var data = JSON.stringify({"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}});
request.send(data);import requests
url = "https://app.tatango.com/api/v2/lists/{ID}/custom_field"
payload = { "custom_field": {
"label": "The Label",
"key": "the_key",
"content_type": "text",
"max_length": 9999,
"pattern": "[A-Za-z0-9]",
"should_validate_regex_via_api": False,
"default_value": "The Default Value"
} }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.tatango.com/api/v2/lists/{ID}/custom_field",
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([
'custom_field' => [
'label' => 'The Label',
'key' => 'the_key',
'content_type' => 'text',
'max_length' => 9999,
'pattern' => '[A-Za-z0-9]',
'should_validate_regex_via_api' => false,
'default_value' => 'The Default Value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tatango.com/api/v2/lists/{ID}/custom_field"
payload := strings.NewReader("{\n \"custom_field\": {\n \"label\": \"The Label\",\n \"key\": \"the_key\",\n \"content_type\": \"text\",\n \"max_length\": 9999,\n \"pattern\": \"[A-Za-z0-9]\",\n \"should_validate_regex_via_api\": false,\n \"default_value\": \"The Default Value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://app.tatango.com/api/v2/lists/{ID}/custom_field")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"custom_field\": {\n \"label\": \"The Label\",\n \"key\": \"the_key\",\n \"content_type\": \"text\",\n \"max_length\": 9999,\n \"pattern\": \"[A-Za-z0-9]\",\n \"should_validate_regex_via_api\": false,\n \"default_value\": \"The Default Value\"\n }\n}")
.asString();{
"status": "OK",
"custom_field": {
"list_id": 30,
"key": "the_key",
"pattern": "[A-Za-z0-9]",
"max_length": 9999,
"default_value": "The Default Value",
"can_insert": true,
"can_segment": true,
"created_at": "2023-11-22T08:14:19.000-08:00",
"updated_at": "2023-11-22T08:14:19.000-08:00",
"mask": null,
"label": "The Label",
"content_type": "text",
"should_validate_regex_via_api": false
}
}{
"status": "error",
"error": "Content type string not allowed. Allowed types are: text, datetime, number"
}Custom Fields
Create a Custom Field
This endpoint creates a custom field.
POST
/
api
/
v2
/
lists
/
{ID}
/
custom_field
cURL
curl "https://app.tatango.com/api/v2/lists/<ID>/custom_field" -d '{"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-u emailaddress@mydomain.com:my_api_key \
-H "Host: example.org" \
-H "Cookie: "require 'net/http'
require 'uri'
uri = URI.parse('https://app.tatango.com/api/v2/lists/<ID>/custom_field')
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_url)
request.basic_auth("emailaddress@mydomain.com", "my_api_key")
request.body = {"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}}.to_json
response = http.request(request)var request = new XMLHttpRequest();
request.open('POST', 'https://app.tatango.com/api/v2/lists/<ID>/custom_field', false);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Basic ' + btoa('emailaddress@mydomain.com:my_api_key'));
var data = JSON.stringify({"custom_field":{"label":"The Label","key":"the_key","content_type":"text","max_length":9999,"pattern":"[A-Za-z0-9]","should_validate_regex_via_api":false,"default_value":"The Default Value"}});
request.send(data);import requests
url = "https://app.tatango.com/api/v2/lists/{ID}/custom_field"
payload = { "custom_field": {
"label": "The Label",
"key": "the_key",
"content_type": "text",
"max_length": 9999,
"pattern": "[A-Za-z0-9]",
"should_validate_regex_via_api": False,
"default_value": "The Default Value"
} }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.tatango.com/api/v2/lists/{ID}/custom_field",
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([
'custom_field' => [
'label' => 'The Label',
'key' => 'the_key',
'content_type' => 'text',
'max_length' => 9999,
'pattern' => '[A-Za-z0-9]',
'should_validate_regex_via_api' => false,
'default_value' => 'The Default Value'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.tatango.com/api/v2/lists/{ID}/custom_field"
payload := strings.NewReader("{\n \"custom_field\": {\n \"label\": \"The Label\",\n \"key\": \"the_key\",\n \"content_type\": \"text\",\n \"max_length\": 9999,\n \"pattern\": \"[A-Za-z0-9]\",\n \"should_validate_regex_via_api\": false,\n \"default_value\": \"The Default Value\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://app.tatango.com/api/v2/lists/{ID}/custom_field")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"custom_field\": {\n \"label\": \"The Label\",\n \"key\": \"the_key\",\n \"content_type\": \"text\",\n \"max_length\": 9999,\n \"pattern\": \"[A-Za-z0-9]\",\n \"should_validate_regex_via_api\": false,\n \"default_value\": \"The Default Value\"\n }\n}")
.asString();{
"status": "OK",
"custom_field": {
"list_id": 30,
"key": "the_key",
"pattern": "[A-Za-z0-9]",
"max_length": 9999,
"default_value": "The Default Value",
"can_insert": true,
"can_segment": true,
"created_at": "2023-11-22T08:14:19.000-08:00",
"updated_at": "2023-11-22T08:14:19.000-08:00",
"mask": null,
"label": "The Label",
"content_type": "text",
"should_validate_regex_via_api": false
}
}{
"status": "error",
"error": "Content type string not allowed. Allowed types are: text, datetime, number"
}