AlayaCare Employee Contacts API

The Employee Contacts API from AlayaCare — 3 operation(s) for employee contacts.

OpenAPI Specification

alayacare-employee-contacts-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 1.0.19-oas3
  title: AlayaCare Accounting Accounts Employee Contacts API
  description: '**AlayaCare IDs:**

    The following terms are used to reference IDs that identify resources in AlayaCare:

    - id

    - visit_id

    - premium_id

    - visit_premium_id

    - employee_id

    - cost_centre_id

    - client_id


    **External IDs**

    The following terms are used to reference IDs that identify resources systems external to AlayaCare:

    - employee_external_id

    - client_external_id


    External IDs are required to be unique.

    No other assumptions are made regarding their format they are treated as strings.

    '
servers:
- url: https://example.alayacare.com/ext/api/v2/accounting
security:
- basic_auth: []
tags:
- name: Employee Contacts
paths:
  /contacts:
    post:
      tags:
      - Employee Contacts
      summary: Create employee contact
      description: '- Only one of `employee_id` or `external_employee_id` can be specified

        '
      parameters:
      - name: body
        description: Employee contact data in JSON format
        in: body
        required: true
        schema:
          $ref: '#/definitions/EmployeeContactCreate'
      responses:
        '201':
          $ref: '#/responses/SuccessResponseEmployeeContactCreate'
        '400':
          $ref: '#/responses/ErrorResponseEmployeeContactInvalidRequest'
        '401':
          $ref: '#/responses/ErrorResponseAuthentication'
        '404':
          $ref: '#/responses/ErrorResponseEmployeeNotFound'
  /contacts/{contact_id}:
    parameters:
    - name: contact_id
      description: AlayaCare ID of the employee contact
      in: path
      type: string
      required: true
    get:
      tags:
      - Employee Contacts
      summary: Get employee contact details using AlayaCare ID
      description: "A contact may be shared by more than one employee or client. Some\nproperties of a contact are tied to the specific relation between\na given employee and their contact. These properties include:\n  - `contact_type`\n  - `relationship`\n\nFor backward compatibility, the employee ID parameters can be\nomitted, but this operation will only succeed if the contact is\nnot shared, therefore ensuring the employee ID is unambiguous.\n\n The relationship properties will be specified in the employees array of the response schema.\n"
      parameters:
      - name: employee_id
        in: query
        type: integer
        required: false
      - name: external_employee_id
        in: query
        type: string
        required: false
      responses:
        '200':
          description: Contact details
          schema:
            $ref: '#/definitions/EmployeeContactDetails'
        '400':
          $ref: '#/responses/ErrorResponseEmployeeContactInvalidRequest'
        '401':
          $ref: '#/responses/ErrorResponseAuthentication'
        '404':
          $ref: '#/responses/ErrorResponseEmployeeContactNotFound'
    put:
      tags:
      - Employee Contacts
      summary: Update employee contact details using AlayaCare ID
      description: "A contact may be shared by more than one employee or client. Some\nproperties of a contact are tied to the specific relation between\na given employee and their contact. These properties include:\n  - `contact_type`\n  - `relationship`\n\nFor backward compatibility, the employee ID attribute can be omitted\nfrom the payload, but the operation will only succeed if the contact\nis not shared, therefore ensuring the employee ID is unambiguos.\n"
      parameters:
      - name: body
        description: Employee contact data in JSON format
        in: body
        required: true
        schema:
          $ref: '#/definitions/EmployeeContactUpdate'
      responses:
        '200':
          $ref: '#/responses/SuccessResponseEmployeeContactUpdate'
        '400':
          $ref: '#/responses/ErrorResponseEmployeeContactInvalidRequest'
        '401':
          $ref: '#/responses/ErrorResponseAuthentication'
        '404':
          $ref: '#/responses/ErrorResponseEmployeeContactNotFound'
  /contacts/by_id/{external_contact_id}:
    parameters:
    - name: external_contact_id
      description: External ID of the employee contact
      in: path
      type: string
      required: true
    get:
      tags:
      - Employee Contacts
      summary: Get employee contact details using external ID
      description: "A contact may be shared by more than one employee or client. Some\nproperties of a contact are tied to the specific relation between\na given employee and their contact. These properties include:\n  - `contact_type`\n  - `relationship`\n\nFor backward compatibility, the employee ID attribute can be omitted\nfrom the payload, but the operation will only succeed if the contact\nis not shared, therefore ensuring the employee ID is unambiguos.\n"
      responses:
        '200':
          description: Contact details
          schema:
            $ref: '#/definitions/EmployeeContactDetails'
        '400':
          $ref: '#/responses/ErrorResponseEmployeeContactInvalidRequest'
        '401':
          $ref: '#/responses/ErrorResponseAuthentication'
        '404':
          $ref: '#/responses/ErrorResponseEmployeeContactNotFound'
    put:
      tags:
      - Employee Contacts
      summary: Update employee contact details using external ID
      description: "A contact may be shared by more than one employee or client. Some\nproperties of a contact are tied to the specific relation between\na given employee and their contact. These properties include:\n  - `contact_type`\n  - `relationship`\n\nFor backward compatibility, the employee ID attribute can be omitted\nfrom the payload, but the operation will only succeed if the contact\nis not shared, therefore ensuring the employee ID is unambiguos.\n"
      parameters:
      - name: body
        description: Employee contact data in JSON format
        in: body
        required: true
        schema:
          $ref: '#/definitions/EmployeeContactUpdate'
      responses:
        '200':
          $ref: '#/responses/SuccessResponseEmployeeContactUpdate'
        '400':
          $ref: '#/responses/ErrorResponseEmployeeContactInvalidRequest'
        '401':
          $ref: '#/responses/ErrorResponseAuthentication'
        '404':
          $ref: '#/responses/ErrorResponseEmployeeContactNotFound'
components:
  securitySchemes:
    basic_auth:
      type: http
      description: Basic HTTP auth over https
      scheme: basic
definitions:
  SuccessResponse:
    description: Success response.
    type: object
    properties:
      id:
        type: integer
        description: AlayaCare ID
      external_id:
        type: string
        description: External ID
        x-nullable: true
    required:
    - id
    - external_id
  EmployeeContact:
    type: object
    properties:
      id:
        type: integer
        description: Employee contact ID
        example: 1
      ac_id:
        type: string
        description: AlayaCare ID for display in-app
        example: AC000000024
      external_id:
        type: string
        example: crm_employee_contact_external_id_1
        description: Employee contact external ID
        x-nullable: true
      status:
        description: Status of a contact
        type: string
        enum:
        - enabled
        - disabled
      contact_type:
        type: string
        example: Medical
        x-nullable: true
      relationship:
        type: string
        example: Doctor
        x-nullable: true
      language:
        type: string
        example: en
      demographics:
        $ref: '#/definitions/EmployeeContactDemographics'
    required:
    - id
    - ac_id
    - external_id
    - status
    - demographics
  EmployeeContactUpdate:
    type: object
    properties:
      external_id:
        type: string
        example: crm_employee_contact_external_id_1
        description: Employee contact external ID
      status:
        description: Status of a contact
        type: string
        enum:
        - enabled
        - disabled
      contact_type:
        type: string
        example: Medical
      relationship:
        type: string
        example: Doctor
      employee_id:
        type: integer
        description: AlayaCare employee ID
        example: 1001
      external_employee_id:
        type: string
        description: External employee ID
        example: sor_employee_external_id_1
      demographics:
        $ref: '#/definitions/EmployeeContactDemographics'
  EmployeeContactDemographics:
    description: 'Collection of key/value pairs where keys are existing attributes in the employee contact profile, defined through the AlayaCare web application.

      On the example below default profile keys for the employeecontact are used.


      Example profile attributes:

      + `first_name`: string

      + `last_name`: string

      + `city`: string

      + `title`: string

      + `state`: string

      + `gender`: string

      + `relationship`: string

      + `contact_type`: string

      + `fax`: string

      + `company`: string

      + `phone_other`: string

      + `phone_main`: string

      + `address`: string

      + `country`: string

      + `zip`: string

      + `address_suite`: string

      + `remarks`: string

      '
    type: object
    properties:
      first_name:
        description: Employee first name
        type: string
        example: Jane
      last_name:
        description: Employee last name
        type: string
        example: Smith
  EmployeeContactRelationship:
    description: AlayaCare employee contact relationship specific properties details
    type: object
    properties:
      contact_type:
        type: string
        example: Medical
        x-nullable: true
      relationship:
        type: string
        example: Doctor
        x-nullable: true
      status:
        $ref: '#/definitions/EmployeeContactStatus'
  EmployeeContactStatus:
    type: string
    enum:
    - enabled
    - disabled
  EmployeeStatus:
    description: 'Enum of the status of an employee

      '
    type: string
    enum:
    - active
    - pending
    - on_hold
    - suspended
    - terminated
    - applicant
    - rejected
    - unknown
  ErrorResponse:
    description: Error response
    type: object
    properties:
      code:
        type: integer
        description: Response code
      message:
        type: string
        description: Detailed error message
    required:
    - code
    - message
  EmployeeContactDetails:
    description: AlayaCare employee list item
    type: object
    allOf:
    - $ref: '#/definitions/EmployeeContact'
    properties:
      employees:
        type: array
        items:
          $ref: '#/definitions/EmployeeContactListDetails'
  EmployeeContactCreate:
    allOf:
    - $ref: '#/definitions/EmployeeContactUpdate'
    type: object
    description: 'When creating an employee contact, either `employee_id` or

      `external_employee_id` must be provided; that will be the

      employee to which the contact is associated.

      If a `profile_id` is provided

      '
    properties:
      profile_id:
        description: AlayaCare profile ID
        type: integer
        example: 7890
  EmployeeContactListDetails:
    description: Employee contact list details
    type: object
    properties:
      id:
        description: AlayaCare employee ID
        type: integer
        example: 1000
      ac_id:
        type: string
        description: AlayaCare employee ID for display in-app
        example: AC000000024
      branch:
        type: object
        description: AlayaCare branch
        properties:
          id:
            description: Branch ID
            type: integer
            example: 1000
          name:
            description: Branch name
            type: string
            example: Toronto branch
      email:
        type: string
        description: employee email address
        example: employee@homecare.com
      external_id:
        description: External employee ID
        type: string
        example: employee_external_id_1
        x-nullable: true
      first_name:
        description: employee first name
        type: string
        example: John
      last_name:
        description: employee last name
        type: string
        example: Smith
      status:
        $ref: '#/definitions/EmployeeStatus'
      contact_relationship:
        $ref: '#/definitions/EmployeeContactRelationship'
      _link:
        description: employee link on the web application
        type: string
        example: https://demo3.alayacare.ca/permalink/employee/b1
responses:
  ErrorResponseAuthentication:
    description: Authorization required
    schema:
      $ref: '#/definitions/ErrorResponse'
    examples:
      application/json:
        code: 401
        message: Authorization required.
  ErrorResponseEmployeeContactInvalidRequest:
    description: Invalid request
    schema:
      $ref: '#/definitions/ErrorResponse'
    examples:
      application/json:
        code: 400
        message: Only employee_id or external_employee_id can be specified
  SuccessResponseEmployeeContactCreate:
    description: Employee contact created successfuly
    schema:
      $ref: '#/definitions/SuccessResponse'
    examples:
      application/json:
        id: 1001
        external_id: crm_employee_contact_external_id_1
  ErrorResponseEmployeeContactNotFound:
    description: Employee contact not found
    schema:
      $ref: '#/definitions/ErrorResponse'
    examples:
      application/json:
        code: 404
        message: Employee contact not found.
  SuccessResponseEmployeeContactUpdate:
    description: Employee contact updated successfuly
    schema:
      $ref: '#/definitions/SuccessResponse'
    examples:
      application/json:
        id: 1001
        external_id: crm_employee_contact_external_id_1
  ErrorResponseEmployeeNotFound:
    description: Employee not found
    schema:
      $ref: '#/definitions/ErrorResponse'
    examples:
      application/json:
        code: 404
        message: Employee not found.