AWeber Custom Fields API
The Custom Fields API from AWeber — 5 operations for creating, reading, renaming and deleting the custom subscriber fields defined on a list.
The Custom Fields API from AWeber — 5 operations for creating, reading, renaming and deleting the custom subscriber fields defined on a list.
openapi: 3.0.2
info:
title: AWeber Custom Fields API
version: '1.0'
description: 'We are constantly working to improve this documentation. If you have
feedback and questions, please contact the AWeber API team at
api@aweber.com.
The AWeber API is a REST API that uses the OAuth 2.0 authentication model. We also offer webhooks.
Please see the below resources for further information:
- <a href="https://labs.aweber.com/docs/tos" target="_blank">Terms of Service</a>
- <a href="https://help.aweber.com/hc/en-us/articles/204031776" target="_blank">Showcasing an Integration</a>
- <a href="https://help.aweber.com/hc/en-us/sections/360000617213-API" target="_blank">Knowledge Base</a>
- <a href="https://status.aweber.com" target="_blank">API Status Page</a>
'
contact:
name: AWeber API Team
email: api@aweber.com
url: https://api.aweber.com/
servers:
- url: https://api.aweber.com/1.0
description: v1 API endpoints
tags:
- name: Custom Fields
description: "### What is it?\n\nRepresents the custom fields associated with a list.\n\nUse this set\
\ of resources to retrieve, create, modify, and delete the custom fields that\nare defined for subscribers\
\ on the list. The single collection response is sorted by the\ngenerated custom field `id` and paginated\
\ using `next_collection_link` and\n`prev_collection_link` properties. See [How Collections are Represented](#collection-representation)\n\
for details on collection traversal.\n\n### Warning about modifying Custom Fields\n\nModifying or\
\ deleting a custom field has a number of side-effects that need to be understood\n*BEFORE* you change\
\ them. See\n<a href=\"https://help.aweber.com/entries/21749682-why-could-changing-my-custom-field-names-cause-problems\"\
\n target=\"_blank\">Why could changing my custom field names cause problems</a> for more details.\n\
\n### Related endpoints\n\n* [Custom Fields](#tag/Custom-Fields)\n* [Find subscribers within an account\
\ by custom field](#tag/Subscribers/paths/~1accounts~1{accountId}?ws.op=findSubscribers/get)\n* [Find\
\ subscribers on a list by custom field](#tag/Subscribers/paths/~1accounts~1{accountId}~1lists~1{listId}~1subscribers?ws.op=find/get)\n\
\n### Related code samples\n\n* [Manage Custom Fields](#tag/Manage-Custom-Fields)\n"
security:
- OAuth 2.0: []
paths:
/accounts/{accountId}/lists/{listId}/custom_fields:
get:
summary: Get custom fields
description: "This endpoint is used to get a paginated collection of custom fields under the specified\
\ account and list\n\nCheck out related examples:\n\n * Manage Custom Fields (\n <a href=\"\
https://github.com/aweber/public-api-examples/blob/master/python/manage-custom-fields\" target=\"\
_blank\">Python</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/php/manage-custom-fields\"\
\ target=\"_blank\">PHP</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/postman/Manage%20Custom%20Fields.postman_collection.json\"\
\ target=\"_blank\">Postman</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/csharp/AWeber.Examples.ManageCustomFields\"\
\ target=\"_blank\">C#.NET</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/ruby/manage_custom_fields.rb\"\
\ target=\"_blank\">Ruby</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/node/manage-custom-fields.js\"\
\ target=\"_blank\">Node.js</a> )"
tags:
- Custom Fields
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/listId'
- $ref: '#/components/parameters/wsStart'
- $ref: '#/components/parameters/wsSize'
security:
- OAuth 2.0:
- list.read
x-code-samples:
- lang: Shell
source: "curl -G \\\n https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields\
\ \\\n -H 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'\n"
- lang: Python
source: "headers = {'Accept': 'application/json',\n 'User-Agent': 'AWeber-Python-code-sample/1.0',\n\
\ 'Authorization': f'Bearer {access_token}'}\nurl = (f'https://api.aweber.com/1.0/accounts/{account_id}'\n\
\ f'/lists/{list_id}/custom_fields')\nresponse = requests.get(url, headers=headers)\n\
print(response.json())\n"
- lang: PHP
source: "$headers = [\n 'User-Agent' => 'AWeber-PHP-code-sample/1.0',\n 'Accept' => 'application/json',\n\
\ 'Authorization' => 'Bearer $token',\n];\n$url = \"https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/custom_fields\"\
;\n$response = $client->get($url, ['headers' => $headers]);\n$body = json_decode($response->getBody(),\
\ true);\nprint_r($body);\n"
- lang: C#
source: 'const string url = "https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields";
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add("Accept","application/json");
request.Headers.Add("User-Agent","AWeber-CSharp-code-sample/1.0");
request.Headers.Add("Authorization", $"Bearer {Token}");
var response = await Client.SendAsync(request);
Console.Write(response.Content.ReadAsStringAsync());
'
- lang: JavaScript
label: Node.js
source: "const headers = {\n \"Accept\": \"application/json\",\n \"User-Agent\": \"AWeber-Node-code-sample/1.0\"\
,\n \"Authorization\": `Bearer ${accessToken}`\n};\nconst url = `https://api.aweber.com/1.0/accounts/${accountId}/lists/${listId}/custom_fields`;\n\
fetch(url, { headers: headers })\n .then(response => response.json())\n .then(data => {\n\
\ console.log(data)\n})\n"
- lang: Ruby
source: "headers = {\n 'Accept': 'application/json',\n 'User-Agent': 'AWeber-Ruby-code-sample/1.0',\n\
\ 'Authorization': \"Bearer #{access_token}\"\n}\nresponse = Faraday.get(\n \"https://api.aweber.com/1.0/accounts/#{account_id}/\"\
\ \\\n \"lists/#{list_id}/custom_fields\",\n) do |req|\n req.headers = headers\nend\nputs\
\ response.body\n"
responses:
'200':
description: The request completed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CustomFields'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/NotFound'
'410':
$ref: '#/components/responses/BlockedError'
'500':
$ref: '#/components/responses/InternalServerError'
'503':
$ref: '#/components/responses/ServiceUnavailable'
operationId: getCustomFields
post:
summary: Add custom field
description: "This endpoint is used to add a new custom field to the specified account and list.\n\
\nCheck out related examples:\n\n * Manage Custom Fields (\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/python/manage-custom-fields\"\
\ target=\"_blank\">Python</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/php/manage-custom-fields\"\
\ target=\"_blank\">PHP</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/postman/Manage%20Custom%20Fields.postman_collection.json\"\
\ target=\"_blank\">Postman</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/csharp/AWeber.Examples.ManageCustomFields\"\
\ target=\"_blank\">C#.NET</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/ruby/manage_custom_fields.rb\"\
\ target=\"_blank\">Ruby</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/node/manage-custom-fields.js\"\
\ target=\"_blank\">Node.js</a> )"
tags:
- Custom Fields
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/listId'
security:
- OAuth 2.0:
- list.write
x-code-samples:
- lang: Shell
source: "curl -X POST \\\n https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields\
\ \\\n -d ws.op=create \\\n -d \"name=Favorite Color\" \\\n -H 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'\n"
- lang: Python
source: "body = {\n 'name': 'Favorite Color',\n 'ws.op': 'create',\n}\nheaders = {'Content-Type':\
\ 'application/x-www-form-urlencoded',\n 'Accept': 'application/json',\n \
\ 'User-Agent': 'AWeber-Python-code-sample/1.0',\n 'Authorization': f'Bearer {access_token}'}\n\
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'\n f'/lists/{list_id}/custom_fields')\n\
response = requests.post(url, headers=headers, data=body)\nprint(response.status_code)\n"
- lang: PHP
source: "$body = [\n 'name' => 'Favorite Color',\n 'ws.op' => 'create',\n];\n$headers =\
\ [\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Accept' => 'application/json',\n\
\ 'Authorization' => 'Bearer $token',\n 'User-Agent' => 'AWeber-PHP-code-sample/1.0'\n\
];\n$url = \"https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/custom_fields\"\
;\n$response = $client->post($url, ['form_params' => $body, 'headers' => $headers]);\necho $response->getStatusCode();\n"
- lang: C#
source: "const string url = \"https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields\"\
;\nvar payload = new Dictionary<string, string>\n{\n {\"ws.op\", \"create\"},\n {\"name\"\
, \"Favorite Color\"}\n};\nvar request = new HttpRequestMessage(HttpMethod.Post, url);\nrequest.Content\
\ = new FormUrlEncodedContent(payload);\nrequest.Headers.Add(\"Accept\",\"application/json\"\
);\nrequest.Headers.Add(\"User-Agent\",\"AWeber-CSharp-code-sample/1.0\");\nrequest.Headers.Add(\"\
Authorization\", $\"Bearer {Token}\");\nvar response = await Client.SendAsync(request);\nConsole.Write(response.Content.ReadAsStringAsync());\n"
- lang: JavaScript
label: Node.js
source: "const headers = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\"\
,\n \"User-Agent\": \"AWeber-Node-code-sample/1.0\",\n \"Authorization\": `Bearer ${accessToken}`\n\
};\nquerystring = require(\"querystring\")\nconst body = querystring.stringify({\n \"name\"\
: \"Favorite Color\",\n \"ws.op\": \"create\"\n});\nconst url = `https://api.aweber.com/1.0/accounts/${accountId}/lists/${listId}/custom_fields`;\n\
fetch(url, { headers: headers, method: \"POST\", body: body })\n .then(response => response.status)\n\
\ .then(data => {\n console.log(data)\n })\n"
- lang: Ruby
source: "headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n\
\ 'User-Agent': 'AWeber-Ruby-code-sample/1.0',\n 'Authorization': \"Bearer #{access_token}\"\
\n}\nbody = {\n 'name': 'Favorite Color',\n 'ws.op': 'create',\n}\nresponse = Faraday.post(\n\
\ \"https://api.aweber.com/1.0/accounts/#{account_id}/\" \\\n \"lists/#{list_id}/custom_fields\"\
,\n URI.encode_www_form(body)\n) do |req|\n req.headers = headers\nend\nputs response.status\n"
responses:
'201':
description: The custom field was created successfully
headers:
Location:
description: URI of the new custom field
example: https://api.aweber.com/1.0/accounts/123/lists/456/custom_fields/7
schema:
type: string
format: uri
'400':
description: The server cannot or will not process the request due to a client error
content:
application/json:
schema:
type: object
properties:
error:
type: object
description: 'An error object.
The following error may be received:
| Error Type | Explanation |
|-----------------|-------------|
| BadRequestError | The `ws.op` field is invalid or the OAuth query string could
not be parsed. This can also be caused by using an unsupported content type. |
| WebServiceError | The custom field could not be added since a field with the specified
name already exists |
'
properties:
documentation_url:
description: A link to the documentation that describes the error
type: string
format: url
example: https://api.aweber.com#badrequest
message:
description: A human friendly description of the error
type: string
example: 'name: Must be unique'
status:
description: The HTTP status code
type: integer
enum:
- 400
type:
description: The API error type
type: string
enum:
- BadRequestError
- WebServiceError
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/NotFound'
'405':
description: The maximum number of custom fields has been exceeded
content:
application/json:
schema:
type: object
properties:
error:
type: object
description: 'An error object.
The following error may be received:
| Error Type | Explanation |
|-----------------|-------------|
| WebServiceError | The custom field could not be added since it already has 25
custom field definitions |
'
properties:
documentation_url:
description: A link to the documentation that describes the error
type: string
format: url
example: https://api.aweber.com#methodnotallowed
message:
description: A human friendly description of the error
type: string
example: You may only have 25 CustomFields
status:
description: The HTTP status code
type: integer
enum:
- 405
type:
description: The API error type
type: string
enum:
- WebServiceError
'410':
$ref: '#/components/responses/BlockedError'
'500':
$ref: '#/components/responses/InternalServerError'
'503':
$ref: '#/components/responses/ServiceUnavailable'
requestBody:
content:
application/json:
schema:
type: object
required:
- name
- ws.op
properties:
name:
description: The name of the custom field
type: string
example: Favorite color
ws.op:
description: The method name - expecting "create"
type: string
enum:
- create
application/x-www-form-urlencoded:
schema:
type: object
required:
- name
- ws.op
properties:
name:
description: The name of the custom field
type: string
example: Favorite color
ws.op:
description: The method name - expecting "create"
type: string
enum:
- create
example: name=foo&ws.op=create
description: Request Body
required: true
operationId: addCustomField
/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}:
get:
summary: Get custom field
description: "This endpoint is used to retrieve the information for the specified custom field.\n\
\nCheck out related examples:\n\n * Manage Custom Fields (\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/python/manage-custom-fields\"\
\ target=\"_blank\">Python</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/php/manage-custom-fields\"\
\ target=\"_blank\">PHP</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/postman/Manage%20Custom%20Fields.postman_collection.json\"\
\ target=\"_blank\">Postman</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/csharp/AWeber.Examples.ManageCustomFields\"\
\ target=\"_blank\">C#.NET</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/ruby/manage_custom_fields.rb\"\
\ target=\"_blank\">Ruby</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/node/manage-custom-fields.js\"\
\ target=\"_blank\">Node.js</a> )"
tags:
- Custom Fields
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/listId'
- $ref: '#/components/parameters/customFieldId'
security:
- OAuth 2.0:
- list.read
x-code-samples:
- lang: Shell
source: "curl -G \\\n https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}\
\ \\\n -H 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'\n"
- lang: Python
source: "headers = {'Accept': 'application/json',\n 'User-Agent': 'AWeber-Python-code-sample/1.0',\n\
\ 'Authorization': f'Bearer {access_token}'}\nurl = (f'https://api.aweber.com/1.0/accounts/{account_id}'\n\
\ f'/lists/{list_id}/custom_fields/{custom_field_id}')\nresponse = requests.get(url, headers=headers)\n\
print(response.json())\n"
- lang: PHP
source: "$headers = [\n 'User-Agent' => 'AWeber-PHP-code-sample/1.0',\n 'Accept' => 'application/json',\n\
\ 'Authorization' => 'Bearer $token',\n];\n$url = \"https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/custom_fields/{$customFieldId}\"\
;\n$response = $client->get($url, ['headers' => $headers]);\n$body = json_decode($response->getBody(),\
\ true);\nprint_r($body);\n"
- lang: C#
source: 'const string url = "https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}";
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add("Accept","application/json");
request.Headers.Add("User-Agent","AWeber-CSharp-code-sample/1.0");
request.Headers.Add("Authorization", $"Bearer {Token}");
var response = await Client.SendAsync(request);
Console.Write(response.Content.ReadAsStringAsync());
'
- lang: JavaScript
label: Node.js
source: "const headers = {\n \"Accept\": \"application/json\",\n \"User-Agent\": \"AWeber-Node-code-sample/1.0\"\
,\n \"Authorization\": `Bearer ${accessToken}`\n};\nconst url = `https://api.aweber.com/1.0/accounts/${accountId}/lists/${listId}/custom_fields/${customFieldId}`;\n\
fetch(url, { headers: headers })\n .then(response => response.json())\n .then(data => {\n\
\ console.log(data)\n})\n"
- lang: Ruby
source: "headers = {\n 'Accept': 'application/json',\n 'User-Agent': 'AWeber-Ruby-code-sample/1.0',\n\
\ 'Authorization': \"Bearer #{access_token}\"\n}\nresponse = Faraday.get(\n \"https://api.aweber.com/1.0/accounts/#{account_id}/\"\
\ \\\n \"lists/#{list_id}/custom_fields/#{custom_field_id}\",\n) do |req|\n req.headers =\
\ headers\nend\nputs response.body\n"
responses:
'200':
description: The request completed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CustomField'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/NotFound'
'410':
$ref: '#/components/responses/BlockedError'
'500':
$ref: '#/components/responses/InternalServerError'
'503':
$ref: '#/components/responses/ServiceUnavailable'
operationId: getCustomField
delete:
summary: Delete custom field
description: "This endpoint is used to delete a custom field entry See <a href=\"https://help.aweber.com/entries/21749682-why-could-changing-my-custom-field-names-cause-problems\"\
\n target=\"_blank\">Why could changing my custom field names cause problems</a>\nbefore removing\
\ a Custom Field.\n\nCheck out related examples:\n\n * Manage Custom Fields (\n <a href=\"\
https://github.com/aweber/public-api-examples/blob/master/python/manage-custom-fields\" target=\"\
_blank\">Python</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/php/manage-custom-fields\"\
\ target=\"_blank\">PHP</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/postman/Manage%20Custom%20Fields.postman_collection.json\"\
\ target=\"_blank\">Postman</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/csharp/AWeber.Examples.ManageCustomFields\"\
\ target=\"_blank\">C#.NET</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/ruby/manage_custom_fields.rb\"\
\ target=\"_blank\">Ruby</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/node/manage-custom-fields.js\"\
\ target=\"_blank\">Node.js</a> )"
tags:
- Custom Fields
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/listId'
- $ref: '#/components/parameters/customFieldId'
security:
- OAuth 2.0:
- list.write
x-code-samples:
- lang: Shell
source: "curl -X DELETE \\\n https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}\
\ \\\n -H 'Authorization: Bearer {YOUR_ACCESS_TOKEN}'\n"
- lang: Python
source: "headers = {'Accept': 'application/json',\n 'User-Agent': 'AWeber-Python-code-sample/1.0',\n\
\ 'Authorization': f'Bearer {access_token}'}\nurl = (f'https://api.aweber.com/1.0/accounts/{account_id}'\n\
\ f'/lists/{list_id}/custom_fields/{custom_field_id}')\nresponse = requests.delete(url,\
\ headers=headers)\nprint(response.status_code)\n"
- lang: PHP
source: "$headers = [\n 'Accept' => 'application/json',\n 'Authorization' => 'Bearer $token',\n\
\ 'User-Agent' => 'AWeber-PHP-code-sample/1.0'\n];\n$url = \"https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/custom_fields/{$customFieldId}\"\
;\n$response = $client->delete($url, ['headers' => $headers]);\necho $response->getStatusCode();\n"
- lang: C#
source: 'const string url = "https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}";
var request = new HttpRequestMessage(HttpMethod.Delete, url);
request.Headers.Add("Accept","application/json");
request.Headers.Add("User-Agent","AWeber-CSharp-code-sample/1.0");
request.Headers.Add("Authorization", $"Bearer {Token}");
var response = await Client.SendAsync(request);
Console.Write(response.StatusCode);
'
- lang: JavaScript
label: Node.js
source: "const headers = {\n \"Accept\": \"application/json\",\n \"User-Agent\": \"AWeber-Node-code-sample/1.0\"\
,\n \"Authorization\": `Bearer ${accessToken}`\n};\nconst url = `https://api.aweber.com/1.0/accounts/${accountId}/lists/${listId}/custom_fields/${customFieldId}`;\n\
fetch(url, { headers: headers, method: \"DELETE\" })\n .then(response => response.status)\n\
\ .then(data => {\n console.log(data)\n })\n"
- lang: Ruby
source: "headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n\
\ 'User-Agent': 'AWeber-Ruby-code-sample/1.0',\n 'Authorization': \"Bearer #{access_token}\"\
\n}\nresponse = Faraday.delete(\n \"https://api.aweber.com/1.0/accounts/#{account_id}/\" \\\
\n \"lists/#{list_id}/custom_fields/#{custom_field_id}\"\n) do |req|\n req.headers = headers\n\
end\nputs response.status\n"
responses:
'200':
description: The custom field was deleted successfully
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'410':
$ref: '#/components/responses/BlockedError'
'500':
$ref: '#/components/responses/InternalServerError'
'503':
$ref: '#/components/responses/ServiceUnavailable'
operationId: deleteCustomField
patch:
summary: Update custom field
description: "This endpoint is used to update the information for the specified custom field. See\
\ <a href=\"https://help.aweber.com/entries/21749682-why-could-changing-my-custom-field-names-cause-problems\"\
\n target=\"_blank\">Why could changing my custom field names cause problems</a>\nbefore changing\
\ the name of a Custom Field.\n\nCheck out related examples:\n\n * Manage Custom Fields (\n \
\ <a href=\"https://github.com/aweber/public-api-examples/blob/master/python/manage-custom-fields\"\
\ target=\"_blank\">Python</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/php/manage-custom-fields\"\
\ target=\"_blank\">PHP</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/postman/Manage%20Custom%20Fields.postman_collection.json\"\
\ target=\"_blank\">Postman</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/csharp/AWeber.Examples.ManageCustomFields\"\
\ target=\"_blank\">C#.NET</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/ruby/manage_custom_fields.rb\"\
\ target=\"_blank\">Ruby</a> |\n <a href=\"https://github.com/aweber/public-api-examples/blob/master/node/manage-custom-fields.js\"\
\ target=\"_blank\">Node.js</a> )"
tags:
- Custom Fields
parameters:
- $ref: '#/components/parameters/accountId'
- $ref: '#/components/parameters/listId'
- $ref: '#/components/parameters/customFieldId'
security:
- OAuth 2.0:
- list.write
x-code-samples:
- lang: Shell
source: "curl -X PATCH \\\n https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}\
\ \\\n -d is_subscriber_updateable=True \\\n -d \"name=Favorite Color\" \\\n -H 'Authorization:\
\ Bearer {YOUR_ACCESS_TOKEN}'\n"
- lang: Python
source: "body = {\n 'name': 'Favorite Color',\n 'is_subscriber_updateable': True,\n}\nheaders\
\ = {'Content-Type': 'application/json',\n 'Accept': 'application/json',\n \
\ 'User-Agent': 'AWeber-Python-code-sample/1.0',\n 'Authorization': f'Bearer {access_token}'}\n\
url = (f'https://api.aweber.com/1.0/accounts/{account_id}'\n f'/lists/{list_id}/custom_fields/{custom_field_id}')\n\
response = requests.patch(url, headers=headers, json=body)\nprint(response.json())\n"
- lang: PHP
source: "$body = [\n 'name' => 'Favorite Color',\n 'is_subscriber_updateable' => true,\n\
];\n$headers = [\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json',\n\
\ 'Authorization' => 'Bearer $token',\n 'User-Agent' => 'AWeber-PHP-code-sample/1.0'\n\
];\n$url = \"https://api.aweber.com/1.0/accounts/{$accountId}/lists/{$listId}/custom_fields/{$customFieldId}\"\
;\n$response = $client->patch($url, ['json' => $body, 'headers' => $headers]);\n$body = json_decode($response->getbody(),\
\ true);\nprint_r($body);\n"
- lang: C#
source: "const string url = \"https://api.aweber.com/1.0/accounts/{accountId}/lists/{listId}/custom_fields/{customFieldId}\"\
;\nvar payload = new Dictionary<string, string>\n{\n {\"is_subscriber_updateable\", \"true\"\
},\n {\"name\", \"Favorite Color\"}\n};\nvar request = new HttpRequestMessage(HttpMethod.Patch,\
\ url);\nrequest.Content = JsonConvert.SerializeObject(payload);\nrequest.Headers.Add(\"Accept\"\
,\"application/json\");\nrequest.Headers.Add(\"User-Agent\",\"AWeber-CSharp-code-sample/1.0\"\
);\nrequest.Headers.Add(\"Authorization\", $\"Bearer {Token}\");\nvar response = await Client.SendAsync(request);\n\
Console.Write(response.Content.ReadAsStringAsync());\n"
- lang: JavaScript
label: Node.js
source: "const headers = {\n \"Accept\": \"application/json\",\n \"Content-Type\": \"application/json\"\
,\n \"User-Agent\": \"AWeber-Node-code-sample/1.0\",\n \"Authorization\": `Bearer ${accessToken}`\n\
};\nconst body = JSON.stringify({\n \"name\": \"Favorite Color\",\n \"is_subscriber_updateable\"\
: true\n});\nconst url = `https://api.aweber.com/1.0/accounts/${accountId}/lists/${listId}/custom_fields/${customFieldId}`;\n\
fetch(url, { headers: headers, method: \"PATCH\", body: body })\n .then(response => response.json())\n\
\ .then(data => {\n console.log(data)\n})\n"
- lang: Ruby
source: "headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n\
\ 'User-Agent': 'AWeber-Ruby-code-sample/1.0',\n 'Authorization': \"Bearer #{access_token}\"\
\n}\nbody = {\n 'name': 'Favorite Color',\n 'is_subscriber_updateable': true\n}\nresponse\
\ = Faraday.patch(\n \"https://api.aweber.com/1.0/accounts/#{account_id}/\" \\\n \"lists/#{list_id}/custom_fields/#{custom_field_id}\"\
\n) do |req|\n req.headers = headers\n req.body = body.to_json\nend\nputs response.body\n"
responses:
'209':
description: The custom field was updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CustomField'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/NotFound'
'410':
$ref: '#/components/responses/BlockedError'
'500':
$ref: '#/components/responses/InternalServerError'
# --- truncated at 32 KB (48 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/aweber/refs/heads/main/openapi/aweber-custom-fields-api-openapi.yml