People and organizations can have multiple types of contact data set for them. These can be set when creating a person or organization or by calling a specific end point to add contact data to an existing person or organization. See the specific content pages for the URLs to access contact data.
Each type of contact data accepts different arguments. This page serves as general documentation for setting contact data.
Data Structure for saving and updating contact data
The general data structure for setting a single contact data record is as follows:
type
- string. The type of contact data. This is discussed in more detail in the sections below.
comment
- string. An optional comment or label for the contact data. For example, you might label an address as "home" or "business".
data
- array. This is an array of data that makes up the contact data record. The structure of this is specific to each contact data type. Specific components are discussed in the sections below.
Note that to pass the individual parts of an array, square brackets are used (such as data[username]
). For example, as a PHP array this might look like:
array(
'type' => 'im',
'comment' => 'label',
'data[service]' => 'aim',
'data[username]' => 'example',
)
Creating a new person or organisation
When creating a new person or organization, you can specify multiple contact data records by passing arrays of contact_data[#]
. The # should be replaced with a number that is the same for each part of a single contact data record. The number itself is arbitrary, it's only used to group data values of the same contact record. Multiple records can be created by using different numbers. For example:
array(
'contact_data[1][type]' => 'im',
'contact_data[1][comment]' => 'label',
'contact_data[1][data][service]' => 'aim',
'contact_data[1][data][username]' => 'example',
'contact_data[2][type]' => 'website',
'contact_data[2][comment]' => 'person',
'contact_data[2][data][url]' => 'http://example.com'
)
Contact Data Types
Address
Type |
address |
data |
address - string. Street address.
city - string. City.
state - string. State, if there is one.
zip - string. Zip or postal code.
country - string. Country name.
|
Facebook
Type |
facebook |
Data |
profile_url - string. URL to the Facebook profile.
|
Instant Message
Type |
instant_message |
data |
service - string. Name of the IM service. Valid services: aim, msn, yim, icq, skype, gtalk, other.
username - string. User name for the service.
|
LinkedIn
Type |
linked_in |
data |
profile_url - string. URL to the LinkedIn profile.
|
Phone
Type |
phone |
data |
country_calling_code - integer. Country dialing code.
number - string. The phone number.
type - string. Type of number. Valid types: phone, mobile, fax.
|
Skype
Type |
skype |
data |
username - string. Skype user name.
|
Twitter
Type |
twitter |
data |
username - string. Twitter user name.
|
Website
Type |
website |
data |
url - string. Website URL.
|
添加一条评论
请登录或注册以提交评论。