curl --request POST \
--url https://api.affinity.co/v2/lists/{listId}/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Sourced By",
"isRequired": true
}
'import requests
url = "https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}"
payload = {
"name": "Sourced By",
"isRequired": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Sourced By', isRequired: true})
};
fetch('https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}', 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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}",
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([
'name' => 'Sourced By',
'isRequired' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}"
payload := strings.NewReader("{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Update a List Field
| This endpoint is currently in BETA |
|---|
Updates a list-specific Field on a List. Only the provided properties are updated.
Requires the Standard role or higher on the List. Updating the List’s Status or Owners field, or changing isRequired, requires the Admin role on the List.
curl --request POST \
--url https://api.affinity.co/v2/lists/{listId}/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Sourced By",
"isRequired": true
}
'import requests
url = "https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}"
payload = {
"name": "Sourced By",
"isRequired": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Sourced By', isRequired: true})
};
fetch('https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}', 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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}",
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([
'name' => 'Sourced By',
'isRequired' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}"
payload := strings.NewReader("{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.affinity.co/v2/lists/{listId}/fields/{fieldId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/lists/{listId}/fields/{fieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sourced By\",\n \"isRequired\": true\n}"
response = http.request(request)
puts response.read_body{
"errors": [
{
"code": "bad-request",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authorization",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "not-found",
"message": "<string>"
}
]
}{
"errors": [
{
"code": "authentication",
"message": "<string>"
}
]
}Authorizations
A static Affinity API key, presented as a bearer token.
Path Parameters
List ID
1 <= x <= 9007199254740991Field ID
"field-1234"
Body
The properties that can be updated on a Field. Only provided properties are updated.
The field's new name. Must be unique among the fields of the same entity type that are available in the same context.
1 - 255"Sourced By"
A description of the field's purpose. Pass null to clear an existing description.
255"Where this company is headquartered"
Whether a value for this field is required when creating an entity or List Entry.
true
Response
No Content
Was this page helpful?