AlayaCare Employee Cost Centres API

The Employee Cost Centres API from AlayaCare — 3 operation(s) for employee cost centres.

OpenAPI Specification

alayacare-employee-cost-centres-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: 1.0.19-oas3
  title: AlayaCare Accounting Accounts Employee Cost Centres 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 Cost Centres
paths:
  /cost_centres/{cost_centre_id}/employees:
    parameters:
    - in: path
      name: cost_centre_id
      description: Cost centre ID
      required: true
      schema:
        type: integer
        minimum: 1
    post:
      tags:
      - Employee Cost Centres
      summary: Add a cost centre to an employee
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CostCentreEmployeeCreateSchema'
        description: '`employee_id` and `employee_external_id` are mutually exclusive, specifying both is an invalid request.

          '
        required: true
      responses:
        '200':
          description: Cost centre added to a employee
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCentreEmployeeResponse'
        '400':
          $ref: '#/components/responses/ErrorResponseCostCentreDisabled'
        '401':
          $ref: '#/components/responses/ErrorResponseAuthentication'
  /cost_centres/{cost_centre_id}/employees/{employee_id}:
    parameters:
    - in: path
      name: cost_centre_id
      description: Cost centre ID
      required: true
      schema:
        type: integer
        minimum: 1
    - in: path
      name: employee_id
      description: Employee ID
      required: true
      schema:
        type: integer
        minimum: 1
    delete:
      tags:
      - Employee Cost Centres
      summary: Delete a cost centre from an employee
      responses:
        '204':
          description: Cost centre deleted from emplouyee
        '400':
          $ref: '#/components/responses/ErrorResponseEmployeeCostCentreNotFound'
        '401':
          $ref: '#/components/responses/ErrorResponseAuthentication'
  /cost_centres/{cost_centre_id}/employees/by_id/{employee_external_id}:
    parameters:
    - in: path
      name: cost_centre_id
      description: Cost centre ID
      required: true
      schema:
        type: integer
        minimum: 1
    - in: path
      name: employee_external_id
      description: Employee external ID
      required: true
      schema:
        type: string
    delete:
      tags:
      - Employee Cost Centres
      summary: Delete a cost centre from an employee using external ID
      responses:
        '204':
          description: Cost centre deleted from emplouyee
        '400':
          $ref: '#/components/responses/ErrorResponseEmployeeCostCentreNotFound'
        '401':
          $ref: '#/components/responses/ErrorResponseAuthentication'
components:
  responses:
    ErrorResponseAuthentication:
      description: Authorization required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            response:
              value:
                code: '401'
                message: Authorization required.
    ErrorResponseEmployeeCostCentreNotFound:
      description: The employee with the referenced cost_centre_id was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            response:
              value:
                code: '400'
                message: Employee with ID 1010 and Cost Centre ID 10 not found
    ErrorResponseCostCentreDisabled:
      description: The cost centre referenced by cost_centre_id is disabled
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            response:
              value:
                code: '400'
                message: Cost centre is disabled
  schemas:
    CostCentreEmployeeCreateSchema:
      type: object
      properties:
        employee_id:
          type: integer
          description: Employee ID
          example: 1010
          minimum: 1
        employee_external_id:
          type: string
          description: Employee external ID
          example: john.1010
    CostCentreEmployeeResponse:
      description: Employee to cost centre link
      type: object
      properties:
        employee_id:
          type: integer
          description: Employee ID
          example: 1010
          minimum: 1
        cost_centre_id:
          type: integer
          description: Cost centre ID
          example: 10
          minimum: 1
    ErrorResponse:
      description: Error response
      type: object
      properties:
        code:
          type: integer
          example: 400
          description: Response code
        message:
          type: string
          example: Invalid request
          description: Detailed error message
      required:
      - code
      - message
  securitySchemes:
    basic_auth:
      type: http
      description: Basic HTTP auth over https
      scheme: basic