API Reference – Marketing API – Creating Custom Fields

Marketing API Method Documentation

©2009-2017 SocketLabs, Inc., Version 0.1, Last Edit: May 25, 2017

POST /customfields/{name}

Synopsis:

Creates a new custom field for your server.

Recommended Usage:

This POST method is used to create a new custom field for your server.  This method takes a single string parameter, called “name”.  This is the name of the custom field that you are creating.  You may have a maximum of 20 custom fields for your server.

Request Information

HTTP Method:

POST

URL:

https://api.socketlabs.com/marketing/v1/customfields/{name}

Response Format Types:

JSON or XML

Request Parameters:

name
The name of the custom field that you are creating.  This value must be a string between 1 and 50 characters.  Certain characters such as HTML tags are forbidden.  There are also certain names that are reserved and cannot be used as a custom field name.  Currently the reserved names are: “EmailAddress”, “ContactId”, and “Id”.  These reserved names are case insensitive.

Example Request:

POST /marketing/v1/customfields/FavoriteTeam HTTP/1.1
Host: api.socketlabs.com
Authorization: Basic XXXXXXXXXXXXXXXXXXXx==
Cache-Control: no-cache

Response Parameters

customFieldNameId
The unique ID for your custom field.
customFieldType
Your custom field’s type.  Currently, custom fields can only be Strings, but other types may be supported in the future.
name
Your custom field’s name.
serverId
Your server’s Id.

Response Examples

Example Response (JSON):

{
 "customFieldNameId": 123,
 "name": "FavoriteTeam",
 "serverId": 98765,
 "customFieldType": "String"
}

Error Codes

There are various scenarios that will result in your custom field not being created successfully. In these cases, we will return an HTTP 409 (conflict) with a relevant message. The following messages may be returned on error:

“message”: “That name is system reserved, please choose another.”
The name of your custom field matched one of the reserved field names.
“message”: “The field ‘{name}’ can’t be created because it already exists.”
This custom field name already exists for your server.
“message”: “You have exceeded the maximum number of Custom Field Names allowed.”
You have exceeded the maximum number of fields (currently 20) allowed for your server.
“message”: “The field Name must be a string with a maximum length of 50.”
The submitted field contained too many characters or was not a string.

Customers Who Trust in SocketLabs

You’re in good company when working with SocketLabs. Here are some companies who have also trusted SocketLabs.

Why SocketLabs?

What Our Customers Are Saying!