Introduction

The Happyoffer API provides a set of endpoints to manage clients and their contacts within a company. These endpoints allow users to retrieve, create, update, and store client and contact information, ensuring that the data is associated with the correct company. Each request verifies that the company_id of the user performing the request matches the company_id of the client or contact being accessed or modified. This ensures data integrity and security, allowing companies to effectively manage their client relationships and contact information.


POST/api/contacts/{contact_id}

Get contact by id

This endpoint retrieves the details of a single contact by its ID. You can only retrieve a contact if it belongs to the same company as the authenticated user. Contacts from other companies are not accessible.

{
    "data": {
        "id": null,
        "attributes": {
            "client_id": null,
            "firstname": null,
            "lastname": null,
            "gender": null,
            "email": null,
            "email_confirmation": null,
            "phone_number": null,
            "note": null
        }
    }
}

POST/api/contacts/{client_id}

Store contact for a client

This endpoint creates a new contact for a specific client, identified by client_id. The request checks if the company_id of the user performing the request matches the company_id associated with the client_id being passed in.

Parameters

  • client_id (string): The unique identifier of the client for whom the contact is being created.

Request Body

The request body must include the following fields:

  • firstname (string, required): The first name of the contact.
  • lastname (string, required): The last name of the contact.
  • gender (string, required): The gender of the contact.
  • email (string, required): The email address of the contact. Must be a valid email format.
  • email_confirmation (string, required): Confirmation of the email address. Must match the email field.
  • phone_number (string, required): The phone number of the contact.
  • notes (string, optional): Any additional notes about the contact.

Example Request

{
  "firstname": "Jane",
  "lastname": "Doe",
  "gender": "Female",
  "email": "jane.doe@example.com",
  "email_confirmation": "jane.doe@example.com",
  "phone_number": "+1-987-654-3210",
  "notes": "Met at the conference."
}

Example Response

{
  "id": "123",
  "attributes": {
    "client_id": "456",
    "firstname": "Jane",
    "lastname": "Doe",
    "gender": "Female",
    "email": "jane.doe@example.com",
    "email_confirmation": "jane.doe@example.com",
    "phone_number": "+1-987-654-3210",
    "note": "Met at the conference."
  }
}

Notes

  • The company_id of the user performing the request must match the company_id associated with the client_id.
  • Ensure that the client_id provided in the request URL is valid and associated with your account.
  • All required fields must be included in the request body.

PATCH/api/contacts/{contact_id}

Update contact by id

This endpoint retrieves a single contact based on the provided contact ID. The request checks if the contact has a client with a company_id that matches the company_id of the user performing the request.

Parameters

  • contact_id (string): The unique identifier of the contact being retrieved.

Example response

{
  "id": "123",
  "attributes": {
    "client_id": "456",
    "firstname": "Jane",
    "lastname": "Doe",
    "gender": "Female",
    "email": "jane.doe@example.com",
    "email_confirmation": "jane.doe@example.com",
    "phone_number": "+1-987-654-3210",
    "note": "Met at the conference."
  }
}

Notes

  • The company_id of the user performing the request must match the company_id associated with the client_id of the contact.
  • Ensure that the contact_id provided in the request URL is valid and associated with your account.
  • Only a single contact will be returned based on the provided contact_id.

Was this page helpful?