Add/Update Contact


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


Punto Final

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

Solicitud
Campo
Tipo
Descripción
id
String
El id del contacto. Este campo es generado por el sistema y no es necesario al crear un nuevo contacto, pero es necesario al actualizar un contacto existente.
firstName
String
El primer nombre del contacto.
lastName
String
El apellido del contacto.
displayName
String
El nombre que se mostrará para el contacto. Si se deja en blanco, se establecerá por defecto el nombre y apellido.
language
String
El idioma preferido para el contacto. Utiliza códigos de idioma ISO 639-1.
Default = `en`
emails
Una lista de direcciones de correo electrónico para el contacto.
phoneNumbers
Una lista de números de teléfono para el contacto.
addresses
Una lista de direcciones para el contacto.
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"
      }
    }
  ]
}


		
Respuesta
Campo
Tipo
Descripción
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"
  ]
}