Add/Update Contact


The following endpoint can be used to add or update a contact within the Hyfin application.


Point de terminaison

The following endpoint can be used to add or update a contact. You must replace the {base_url} and {site_id} variable with the id of the customer that this contact belongs to.

POST
{base_url}/api/v4/site/{site_id}/contact/addUpdate

Demande
Champ
Type
Requis
Description
_id
String
L'identifiant du contact. Ce champ est généré par le système et n'est pas requis lors de la création d'un nouveau contact, mais il est requis lors de la mise à jour d'un contact existant.
first_name
String
--
Le prénom du contact.
last_name
String
--
Le nom de famille du contact.
display_name
String
--
Le nom qui sera affiché pour le contact. S'il est laissé vide, il sera par défaut le prénom et le nom de famille.
language
String
--
La langue préférée pour le contact. Utilise les codes de langue ISO 639-1.
Default = `en`
emails
--
Une liste d'adresses courriel pour le contact.
phone_numbers
--
Une liste de numéros de téléphone pour le contact.
addresses
--
Une liste d'adresses pour le contact.
Sample Request (Add a Contact)
			
				{
  "first_name": "John",
  "last_name": "Doe",
  "display_name": "John Doe",
  "language": "en",
  "emails": [
    {
      "label": "work",
      "address": "johndoe@abc.com",
      "is_primary": true
    }
  ],
  "phone_numbers": [
    {
      "label": "mobile",
      "number": "333-444-5555",
      "is_primary": true
    }
  ],
  "addresses": [
    {
      "label": "billing",
      "is_primary": true,
      "address": {
        "address_line1": "123 Main Street",
        "address_line2": "Suite 123",
        "city": "Naples",
        "state_code": "FL",
        "zip_code": "34102"
      }
    }
  ]
}
			
		
Réponse
Champ
Type
Description
success
Boolean
Whether the record was added or updated successfully.
action
String
Informs whether the record was added or updated. Will only be returned if `success` is `true`.
One of `added`, `updated`
_id
String
The auto generated id assigned to the record.
errors
String [ ]
A list of errors. Will only be returned if `success` is `false`.
Sample Response (Successful)
			
				{
  "success": true,
  "action": "added",
  "_id": "60f720d248f143332af022e0"
}
			
		
Sample Response (Failed)
			
				{
  "success": false,
  "errors": [
    "invalid field2",
    "missing field_name"
  ]
}