Skip to content

Latest commit

 

History

History
375 lines (262 loc) · 12.2 KB

ContactsCustomFieldsApi.md

File metadata and controls

375 lines (262 loc) · 12.2 KB

ConstantContactClient::ContactsCustomFieldsApi

All URIs are relative to https://api.cc.email/v3

Method HTTP request Description
create_custom_fields POST /contact_custom_fields POST (create) a custom_field
delete_custom_field DELETE /contact_custom_fields/{custom_field_id} DELETE a custom_field
get_all_custom_fields GET /contact_custom_fields GET custom_fields Collection
get_custom_field GET /contact_custom_fields/{custom_field_id} GET a custom_field
update_custom_field PUT /contact_custom_fields/{custom_field_id} Update a custom field.

create_custom_fields

create_custom_fields(create_custom_fields_request)

POST (create) a custom_field

Custom fields are extra data fields you create to store additional information about your contacts, such as preferences, membership levels, and interests. Use custom fields to organize contacts, send personalized email campaigns, and to identify a targeted audience for a specific campaign. Custom fields types include text, number, date, drop-down lists, radio buttons, and checkboxes. A user can configure up to 100 custom_fields in their account.

Examples

require 'time'
require 'constant_contact_client'
# setup authorization
ConstantContactClient.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2_access_code
  config.access_token = 'YOUR ACCESS TOKEN'

  # Configure OAuth2 access token for authorization: oauth2_implicit
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = ConstantContactClient::ContactsCustomFieldsApi.new
create_custom_fields_request = ConstantContactClient::CreateCustomFieldsRequest.new # CreateCustomFieldsRequest | The JSON payload required to create a new custom field.

begin
  # POST (create) a custom_field
  result = api_instance.create_custom_fields(create_custom_fields_request)
  p result
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->create_custom_fields: #{e}"
end

Using the create_custom_fields_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_custom_fields_with_http_info(create_custom_fields_request)

begin
  # POST (create) a custom_field
  data, status_code, headers = api_instance.create_custom_fields_with_http_info(create_custom_fields_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetCustomField200Response>
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->create_custom_fields_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_custom_fields_request CreateCustomFieldsRequest The JSON payload required to create a new custom field.

Return type

GetCustomField200Response

Authorization

oauth2_access_code, oauth2_implicit

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

delete_custom_field

delete_custom_field(custom_field_id)

DELETE a custom_field

Delete a custom field from the user's account.

Examples

require 'time'
require 'constant_contact_client'
# setup authorization
ConstantContactClient.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2_access_code
  config.access_token = 'YOUR ACCESS TOKEN'

  # Configure OAuth2 access token for authorization: oauth2_implicit
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = ConstantContactClient::ContactsCustomFieldsApi.new
custom_field_id = '04fe9a-a579-43c5-bb1a-58ed29bf0a6a' # String | The ID that uniquely identifies the custom field to delete.

begin
  # DELETE a custom_field
  api_instance.delete_custom_field(custom_field_id)
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->delete_custom_field: #{e}"
end

Using the delete_custom_field_with_http_info variant

This returns an Array which contains the response data (nil in this case), status code and headers.

<Array(nil, Integer, Hash)> delete_custom_field_with_http_info(custom_field_id)

begin
  # DELETE a custom_field
  data, status_code, headers = api_instance.delete_custom_field_with_http_info(custom_field_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->delete_custom_field_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
custom_field_id String The ID that uniquely identifies the custom field to delete.

Return type

nil (empty response body)

Authorization

oauth2_access_code, oauth2_implicit

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

get_all_custom_fields

get_all_custom_fields(opts)

GET custom_fields Collection

Get all custom fields defined in the user's account. <div class="Msg"><p class="note-text">This method does not currently support filtering results using the custom field update date.

Examples

require 'time'
require 'constant_contact_client'
# setup authorization
ConstantContactClient.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2_access_code
  config.access_token = 'YOUR ACCESS TOKEN'

  # Configure OAuth2 access token for authorization: oauth2_implicit
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = ConstantContactClient::ContactsCustomFieldsApi.new
opts = {
  limit: 56 # Integer | Specifies the number of results displayed per page of output, from 1 - 100, default = 50.
}

begin
  # GET custom_fields Collection
  result = api_instance.get_all_custom_fields(opts)
  p result
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->get_all_custom_fields: #{e}"
end

Using the get_all_custom_fields_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_all_custom_fields_with_http_info(opts)

begin
  # GET custom_fields Collection
  data, status_code, headers = api_instance.get_all_custom_fields_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetAllCustomFields200Response>
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->get_all_custom_fields_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
limit Integer Specifies the number of results displayed per page of output, from 1 - 100, default = 50. [optional][default to 50]

Return type

GetAllCustomFields200Response

Authorization

oauth2_access_code, oauth2_implicit

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_custom_field

get_custom_field(custom_field_id)

GET a custom_field

Get details for a specified custom field.

Examples

require 'time'
require 'constant_contact_client'
# setup authorization
ConstantContactClient.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2_access_code
  config.access_token = 'YOUR ACCESS TOKEN'

  # Configure OAuth2 access token for authorization: oauth2_implicit
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = ConstantContactClient::ContactsCustomFieldsApi.new
custom_field_id = '04fe9a-a579-43c5-bb1a-58ed29bf0a6a' # String | The ID that uniquely identifies the custom field.

begin
  # GET a custom_field
  result = api_instance.get_custom_field(custom_field_id)
  p result
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->get_custom_field: #{e}"
end

Using the get_custom_field_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_custom_field_with_http_info(custom_field_id)

begin
  # GET a custom_field
  data, status_code, headers = api_instance.get_custom_field_with_http_info(custom_field_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetCustomField200Response>
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->get_custom_field_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
custom_field_id String The ID that uniquely identifies the custom field.

Return type

GetCustomField200Response

Authorization

oauth2_access_code, oauth2_implicit

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

update_custom_field

update_custom_field(custom_field_id, update_custom_field_request)

Update a custom field.

Update an existing custom field.

Examples

require 'time'
require 'constant_contact_client'
# setup authorization
ConstantContactClient.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2_access_code
  config.access_token = 'YOUR ACCESS TOKEN'

  # Configure OAuth2 access token for authorization: oauth2_implicit
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = ConstantContactClient::ContactsCustomFieldsApi.new
custom_field_id = '04fe9a-a579-43c5-bb1a-58ed29bf0a6a' # String | The ID that uniquely identifies the custom field to update.
update_custom_field_request = ConstantContactClient::UpdateCustomFieldRequest.new # UpdateCustomFieldRequest | The JSON payload used to update an existing custom field. Any properties omitted in the PUT request are overwritten with a null value.

begin
  # Update a custom field.
  result = api_instance.update_custom_field(custom_field_id, update_custom_field_request)
  p result
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->update_custom_field: #{e}"
end

Using the update_custom_field_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_custom_field_with_http_info(custom_field_id, update_custom_field_request)

begin
  # Update a custom field.
  data, status_code, headers = api_instance.update_custom_field_with_http_info(custom_field_id, update_custom_field_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetCustomField200Response>
rescue ConstantContactClient::ApiError => e
  puts "Error when calling ContactsCustomFieldsApi->update_custom_field_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
custom_field_id String The ID that uniquely identifies the custom field to update.
update_custom_field_request UpdateCustomFieldRequest The JSON payload used to update an existing custom field. Any properties omitted in the PUT request are overwritten with a null value.

Return type

GetCustomField200Response

Authorization

oauth2_access_code, oauth2_implicit

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json