cURL
curl --request PATCH \
--url https://platform.thena.ai/v1/custom-field \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fields": [
{
"fieldId": "<string>",
"version": 123,
"updates": {
"name": "<string>",
"description": "<string>",
"isActive": true,
"options": [
{
"value": "<string>"
}
],
"placeholderText": "<string>",
"hintText": "<string>",
"defaultValue": "<string>",
"regexForValidation": "<string>",
"mandatoryOnCreation": true,
"mandatoryOnClose": true,
"visibleToCustomer": true,
"editableByCustomer": true,
"autoAddToAllForms": true
}
}
]
}
'import requests
url = "https://platform.thena.ai/v1/custom-field"
payload = { "fields": [
{
"fieldId": "<string>",
"version": 123,
"updates": {
"name": "<string>",
"description": "<string>",
"isActive": True,
"options": [{ "value": "<string>" }],
"placeholderText": "<string>",
"hintText": "<string>",
"defaultValue": "<string>",
"regexForValidation": "<string>",
"mandatoryOnCreation": True,
"mandatoryOnClose": True,
"visibleToCustomer": True,
"editableByCustomer": True,
"autoAddToAllForms": True
}
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: [
{
fieldId: '<string>',
version: 123,
updates: {
name: '<string>',
description: '<string>',
isActive: true,
options: [{value: '<string>'}],
placeholderText: '<string>',
hintText: '<string>',
defaultValue: '<string>',
regexForValidation: '<string>',
mandatoryOnCreation: true,
mandatoryOnClose: true,
visibleToCustomer: true,
editableByCustomer: true,
autoAddToAllForms: true
}
}
]
})
};
fetch('https://platform.thena.ai/v1/custom-field', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.thena.ai/v1/custom-field",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
[
'fieldId' => '<string>',
'version' => 123,
'updates' => [
'name' => '<string>',
'description' => '<string>',
'isActive' => true,
'options' => [
[
'value' => '<string>'
]
],
'placeholderText' => '<string>',
'hintText' => '<string>',
'defaultValue' => '<string>',
'regexForValidation' => '<string>',
'mandatoryOnCreation' => true,
'mandatoryOnClose' => true,
'visibleToCustomer' => true,
'editableByCustomer' => true,
'autoAddToAllForms' => true
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://platform.thena.ai/v1/custom-field"
payload := strings.NewReader("{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://platform.thena.ai/v1/custom-field")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.thena.ai/v1/custom-field")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "<string>",
"uid": "<string>",
"slug": "<string>",
"organizationId": "<string>",
"options": [
"<string>"
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"isActive": true,
"teamId": "<string>",
"autoAddToAllForms": true,
"hintText": "<string>",
"placeholderText": "<string>",
"mandatoryOnCreation": true,
"mandatoryOnClose": true,
"visibleToCustomer": true,
"editableByCustomer": true,
"defaultValue": "<string>"
}
],
"status": true,
"message": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"message": "Failed to update field cf_01jb4xm9qr3kv5w8n2p7s9t1 due to version mismatch or concurrent modification",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00Z"
}{
"message": [
{
"property": "fields.0.fieldId",
"constraints": {
"isString": "fieldId must be a string",
"minLength": "fieldId must be a non-empty string"
}
},
{
"property": "fields.0.version",
"constraints": {
"isInt": "version must be an integer"
}
}
],
"error": "Validation Error",
"statusCode": 422
}Custom fields
Update custom fields
PATCH
/
v1
/
custom-field
cURL
curl --request PATCH \
--url https://platform.thena.ai/v1/custom-field \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fields": [
{
"fieldId": "<string>",
"version": 123,
"updates": {
"name": "<string>",
"description": "<string>",
"isActive": true,
"options": [
{
"value": "<string>"
}
],
"placeholderText": "<string>",
"hintText": "<string>",
"defaultValue": "<string>",
"regexForValidation": "<string>",
"mandatoryOnCreation": true,
"mandatoryOnClose": true,
"visibleToCustomer": true,
"editableByCustomer": true,
"autoAddToAllForms": true
}
}
]
}
'import requests
url = "https://platform.thena.ai/v1/custom-field"
payload = { "fields": [
{
"fieldId": "<string>",
"version": 123,
"updates": {
"name": "<string>",
"description": "<string>",
"isActive": True,
"options": [{ "value": "<string>" }],
"placeholderText": "<string>",
"hintText": "<string>",
"defaultValue": "<string>",
"regexForValidation": "<string>",
"mandatoryOnCreation": True,
"mandatoryOnClose": True,
"visibleToCustomer": True,
"editableByCustomer": True,
"autoAddToAllForms": True
}
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fields: [
{
fieldId: '<string>',
version: 123,
updates: {
name: '<string>',
description: '<string>',
isActive: true,
options: [{value: '<string>'}],
placeholderText: '<string>',
hintText: '<string>',
defaultValue: '<string>',
regexForValidation: '<string>',
mandatoryOnCreation: true,
mandatoryOnClose: true,
visibleToCustomer: true,
editableByCustomer: true,
autoAddToAllForms: true
}
}
]
})
};
fetch('https://platform.thena.ai/v1/custom-field', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://platform.thena.ai/v1/custom-field",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'fields' => [
[
'fieldId' => '<string>',
'version' => 123,
'updates' => [
'name' => '<string>',
'description' => '<string>',
'isActive' => true,
'options' => [
[
'value' => '<string>'
]
],
'placeholderText' => '<string>',
'hintText' => '<string>',
'defaultValue' => '<string>',
'regexForValidation' => '<string>',
'mandatoryOnCreation' => true,
'mandatoryOnClose' => true,
'visibleToCustomer' => true,
'editableByCustomer' => true,
'autoAddToAllForms' => true
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://platform.thena.ai/v1/custom-field"
payload := strings.NewReader("{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.patch("https://platform.thena.ai/v1/custom-field")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.thena.ai/v1/custom-field")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fields\": [\n {\n \"fieldId\": \"<string>\",\n \"version\": 123,\n \"updates\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"isActive\": true,\n \"options\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"placeholderText\": \"<string>\",\n \"hintText\": \"<string>\",\n \"defaultValue\": \"<string>\",\n \"regexForValidation\": \"<string>\",\n \"mandatoryOnCreation\": true,\n \"mandatoryOnClose\": true,\n \"visibleToCustomer\": true,\n \"editableByCustomer\": true,\n \"autoAddToAllForms\": true\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "<string>",
"uid": "<string>",
"slug": "<string>",
"organizationId": "<string>",
"options": [
"<string>"
],
"metadata": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"isActive": true,
"teamId": "<string>",
"autoAddToAllForms": true,
"hintText": "<string>",
"placeholderText": "<string>",
"mandatoryOnCreation": true,
"mandatoryOnClose": true,
"visibleToCustomer": true,
"editableByCustomer": true,
"defaultValue": "<string>"
}
],
"status": true,
"message": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"message": "Failed to update field cf_01jb4xm9qr3kv5w8n2p7s9t1 due to version mismatch or concurrent modification",
"statusCode": 400,
"timestamp": "2024-01-15T10:30:00Z"
}{
"message": [
{
"property": "fields.0.fieldId",
"constraints": {
"isString": "fieldId must be a string",
"minLength": "fieldId must be a non-empty string"
}
},
{
"property": "fields.0.version",
"constraints": {
"isInt": "version must be an integer"
}
}
],
"error": "Validation Error",
"statusCode": 422
}⌘I