Contacts
Contents
List Contacts
List all contacts. For more information see Contacts document model.
Endpoint:
URL |
|
Method |
|
Expected response code |
|
Expected response type |
|
Example:
curl -v \
-H "Authorization: apikey $API_USER:$API_KEY" \
$COREDATA_BASE_URL/api/v2/contacts/
Example response:
Result contacts are sorted by creation date ascending and then by ID ascending (to get stable sorting results).
List Favourite Contacts
See User home | List-favourite-Contacts.
Get Contact details
Get details of an existing Contact.
Endpoint:
URL |
|
Method |
|
Expected response code |
|
Expected response type |
|
URL parameters:
contact_id
– ID of an existing contact to get details for.
Example:
contact_id=73c2314c-7758-11ee-b86c-1b2d654e4cc1
curl -v \
-H "Authorization: apikey $API_USER:$API_KEY" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/
Where:
contact_id
– ID of an existing contact.
Example response:
Create Contact
Create a new contact.
Endpoint:
URL |
|
Method |
|
Content-Type |
|
Expected response code |
|
Request JSON body may contain the following fields:
Field | Type | Description | Mandatory |
---|---|---|---|
|
| The name of the contact. | Yes |
|
| SSN (kennitala). | No |
|
| Contact status from | No |
|
| Text description. | No |
|
| A list of emails and labels. Example: | No |
|
| A list of phone numbers and labels. Example: | No |
|
| A list of addresses. Example: | No |
|
| A list of URLs. Example: | No |
|
| ID of a ID of an
| No |
|
| ID of an
| No |
|
| A contact’s role. For available roles see the E.g. | No |
|
| ID of a contact template. There are predefined contact templates | No |
[1]
A Person
contact can be created in ContactFolder
or Organization
. An Organization
contact can only be created in ContactFolder
.
[2]
Only a Person
contact can be created in Organization
.
See Contacts document model for more details.
TODOs:
Describe contact creation using template.
Describe template values overriding when creating contact.
Create a Contact in default global Space
An Organizaation
contact is created in the global space by default if no parent
and organization
parameters are provided.
Example:
title="John Doe"
curl -v \
-X POST \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\"}" \
$COREDATA_BASE_URL/api/v2/contacts/
The response contains Location
header having URL of the newly created contact, where we can can get the contact ID from:
Location: /api/v2/contacts/45330c2a-77da-11ee-81b1-0b61c7eec308/
The document path of the new Contact
is:
/domain/spaces/system/global/Contacts/John Doe
Create a Contact in a ContactFolder
An Organization
contact can be created in a certain ContactFolder
.
Example:
contact_folder_id=65680e48-846c-11ee-8b63-77a168612873
title="John Doe"
curl -v \
-X POST \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"parent\": \"$contact_folder_id\", \"title\": \"$title\"}" \
$COREDATA_BASE_URL/api/v2/contacts/
The response contains Location
header with URL of the newly created Contact
:
Location: /api/v2/contacts/c6976fec-846c-11ee-914c-2f3bdb64f9ef/
The document path of the new Contact
is:
/domain/spaces/system/global/Contacts/ContactFolder-0/John Doe
Create a Person in an Organization
As by default contacts are created as Organization
, and an Organization
can not sit in another Organization
, then to create a Person
in an Organization
we need to provide template
parameter with Person
template ID.
Example:
person_template_id=d95feda2-7f17-11ee-a7dc-d7778754bdc7
organization_id=c6976fec-846c-11ee-914c-2f3bdb64f9ef
title="John Doe"
curl -v \
-X POST \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"organization\": \"$organization_id\", \"template\": \"$person_template_id\", \"title\": \"$title\"}" \
$COREDATA_BASE_URL/api/v2/contacts/
Response has Location
header containing URL for the newly created contact:
Location: /api/v2/contacts/9fa9469c-84a5-11ee-b8b1-d7a342ab96d3/
For more information on using templates for document creation see CoreData domain model | Document-creation.
Update a Contact
Update an existing contact.
Endpoint:
URL |
|
Method |
|
Content-Type |
|
Expected response code |
|
URL parameters:
contact_id
– ID of an existing contact to update.
For supported body parameters see Create Contact section above.
Example:
contact_id=45330c2a-77da-11ee-81b1-0b61c7eec308
title="John Brown"
curl -v \
-X PUT \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\"}" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/
Move a Contact to the global ContactFolder
Example:
contact_id=9fa9469c-84a5-11ee-b8b1-d7a342ab96d3
curl -v \
-X PUT \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"parent\": \"\"}" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/
Contact’s document path before update:
/domain/spaces/system/global/Contacts/Some-ContactFolder/John Doe
Contact’s document path after update:
/domain/spaces/system/global/Contacts/John Doe
Move a Contact to a ContactFolder
Example:
contact_id=9fa9469c-84a5-11ee-b8b1-d7a342ab96d3
contact_folder_id=65680e48-846c-11ee-8b63-77a168612873
curl -v \
-X PUT \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"parent\": \"$contact_folder_id\"}" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/
Contact’s document path before update:
/domain/spaces/system/global/Contacts/John Doe
Contact’s document path after update:
/domain/spaces/system/global/Contacts/Some-ContactFolder/John Doe
Move a Person to an Organization
Example:
contact_id=9fa9469c-84a5-11ee-b8b1-d7a342ab96d3
ogranization_id=dd8dc638-7f17-11ee-8bc1-8b0841296ad4
curl -v \
-X PUT \
-H "Authorization: apikey $API_USER:$API_KEY" \
-H "Content-Type: application/json" \
-d "{\"organization\": \"$ogranization_id\"}" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/
Contact’s document path before update:
/domain/spaces/system/global/Contacts/Some-ContactFolder/John Doe
Contact’s document path after update:
/domain/spaces/system/global/Contacts/Some-Organization/John Doe
Delete Contact
Delete an existing contact.
Endpoint:
URL |
|
Method |
|
Expected response code |
|
URL parameters:
contact_id
– ID of an existing contact to update.
Example:
contact_id=45330c2a-77da-11ee-81b1-0b61c7eec308
curl -v \
-X DELETE \
-H "Authorization: apikey $API_USER:$API_KEY" \
$COREDATA_BASE_URL/api/v2/contacts/$contact_id/