{"swagger":"2.0","info":{"title":"AlayaCare Employee Availabilities API","version":"1.0.0","description":"**AlayaCare IDs:**\nThe following terms are used to reference IDs that identify resources in AlayaCare:\n- employee_id\n- availability_id\n\n**External IDs**\nThe following terms are used to reference IDs that identify resources systems external to AlayaCare:\n- external_employee_id\n\nExternal IDs are required to be unique.\nNo other assumptions are made regarding their format they are treated as strings.\n\n**Remarks**\n- All dates must be in ISO 8601 format converted to UTC timezone\n\n**Employee Availabilities Considerations**\n- Configuring Employee Availabilities will have repercussions in the AlayaCare application.\n","contact":{"name":"AlayaCare"}},"securityDefinitions":{"basic_auth":{"type":"basic","description":"Basic HTTP auth over https"}},"schemes":["https"],"consumes":["application/json"],"produces":["application/json"],"paths":{"/employee/{employee_id}/availabilities":{"parameters":[{"name":"employee_id","description":"AlayaCare ID of the employee","in":"path","type":"string","required":true}],"get":{"tags":["Employee Availabilities"],"parameters":[{"$ref":"#/parameters/page"},{"$ref":"#/parameters/count"},{"name":"start_date_from","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability start date greater or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-03`\n"},{"name":"start_date_to","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability start date less than or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-18`\n"},{"name":"end_date_from","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability end date greater or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-03`\n"},{"name":"end_date_to","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability end date less than or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-18`\n"},{"name":"availability_type_id","description":"Filter by AlayaCare availability type ID.","in":"query","type":"integer"},{"name":"filter","description":"Substring search on availability `description` and `rrule`.","in":"query","type":"string","required":false},{"name":"order","description":"Order `items` in **ascending** or **descending** order. By default, `items` are ordered by `id` of the availability in ascending order.\nFor example:\n-`order=asc` will order `items` in ascending order\n-`order=desc` will order `items` in descending order\n","in":"query","type":"string","required":false},{"name":"order_by","description":"Order `items` by availability **start date** or **end date**. By default, `items` are ordered by `id` of the availability in ascending order.\nFor example:\n-`order_by=start_at` will order `items` by start date in ascending order\n-`order_by=end_at&order=desc` will order `items` by end date in descending order\n","in":"query","type":"string","required":false}],"summary":"Get a list of an employee availabilities using its AlayaCare ID\n","responses":{"200":{"description":"A list of an employee availabilities","schema":{"$ref":"#/definitions/AvailabilitiesList"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"404":{"$ref":"#/responses/ErrorResponseEmployeeNotFound"}}},"post":{"tags":["Employee Availabilities"],"summary":"Create an employee availability using its AlayaCare ID\n","description":"* `availability_type_id` is optional; if omitted, the system default availability type will be assigned\n* `duration` can only be set when `all_day` is set to `false`\n","parameters":[{"name":"body","description":"Availability data in JSON format","in":"body","required":true,"schema":{"$ref":"#/definitions/AvailabilityCreate"}}],"responses":{"201":{"description":"Availability created successfully","schema":{"$ref":"#/definitions/AvailabilityCreated"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":400,"message":"Field 'availability_type_id' is invalid"}}},"404":{"$ref":"#/responses/ErrorResponseEmployeeNotFound"},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":409,"message":"Role conflict: Availability Type cannot be assigned to the employee"}}}}}},"/employee/by_id/{external_employee_id}/availabilities":{"parameters":[{"name":"external_employee_id","description":"External ID of the employee","in":"path","type":"string","required":true}],"get":{"tags":["Employee Availabilities"],"parameters":[{"$ref":"#/parameters/page"},{"$ref":"#/parameters/count"},{"name":"start_date_from","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability start date greater or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-03`\n"},{"name":"start_date_to","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability start date less than or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-18`\n"},{"name":"end_date_from","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability end date greater or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-03`\n"},{"name":"end_date_to","in":"query","required":false,"type":"string","format":"date","description":"Filter by availability end date less than or equal than specified value.\nExpected format is ISO 8601 converted to UTC timezone.\nEx: `2020-02-18`\n"},{"name":"availability_type_id","description":"Filter by AlayaCare availability type ID.","in":"query","type":"integer"},{"name":"filter","description":"Substring search on availability `description` and `rrule`.","in":"query","type":"string","required":false},{"name":"order","description":"Order `items` in **ascending** or **descending** order. By default, `items` are ordered by `id` of the availability in ascending order.\nFor example:\n-`order=asc` will order `items` in ascending order\n-`order=desc` will order `items` in descending order\n","in":"query","type":"string","required":false},{"name":"order_by","description":"Order `items` by availability **start date** or **end date**. By default, `items` are ordered by `id` of the availability in ascending order.\nFor example:\n-`order_by=start_at` will order `items` by start date in ascending order\n-`order_by=end_at&order=desc` will order `items` by end date in descending order\n","in":"query","type":"string","required":false}],"summary":"Get a list of an employee availabilities using its External Employee ID\n","responses":{"200":{"description":"A list of an employee availabilities","schema":{"$ref":"#/definitions/AvailabilitiesList"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"404":{"$ref":"#/responses/ErrorResponseEmployeeNotFound"}}},"post":{"tags":["Employee Availabilities"],"summary":"Create an employee availability using its External Employee ID\n","description":"* `availability_type_id` is optional; if omitted, the system default availability type will be assigned\n* `duration` can only be set when `all_day` is set to `false`\n","parameters":[{"name":"body","description":"Availability data in JSON format","in":"body","required":true,"schema":{"$ref":"#/definitions/AvailabilityCreate"}}],"responses":{"201":{"description":"Availability created successfully","schema":{"$ref":"#/definitions/AvailabilityCreated"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":400,"message":"Field 'availability_type_id' is invalid"}}},"404":{"$ref":"#/responses/ErrorResponseEmployeeNotFound"},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":409,"message":"Role conflict: Availability Type cannot be assigned to the employee"}}}}}},"/availabilities/{availability_id}":{"parameters":[{"name":"availability_id","description":"AlayaCare ID of the availability","in":"path","type":"string","required":true}],"get":{"tags":["Availabilities"],"summary":"Get an employee availability details using its AlayaCare Availability ID\n","responses":{"200":{"description":"Availability details","schema":{"$ref":"#/definitions/Availability"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"404":{"$ref":"#/responses/ErrorResponseEmployeeAvailabilityNotFound"}}},"put":{"tags":["Availabilities"],"summary":"Update an employee availability details using its AlayaCare Availability ID\n","description":"* `duration` can only be updated when `all_day` is set to `false`\n","parameters":[{"name":"body","description":"Availability data in JSON format","in":"body","required":true,"schema":{"$ref":"#/definitions/AvailabilityUpdate"}}],"responses":{"200":{"description":"Availability updated successfully","schema":{"$ref":"#/definitions/AvailabilityCreated"}},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":400,"message":"Field 'availability_type_id' is invalid"}}},"404":{"$ref":"#/responses/ErrorResponseEmployeeAvailabilityNotFound"},"409":{"description":"Conflict","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":409,"message":"Role conflict: Availability Type cannot be assigned to the employee"}}}}},"delete":{"tags":["Availabilities"],"summary":"Remove an employee availability using its AlayaCare Availability ID\n","responses":{"204":{"description":"Availability successfully deleted"},"401":{"$ref":"#/responses/ErrorResponseAuthentication"},"404":{"$ref":"#/responses/ErrorResponseEmployeeAvailabilityNotFound"}}}}},"parameters":{"page":{"description":"Filter by page number.","name":"page","default":1,"in":"query","required":false,"type":"integer"},"count":{"description":"Number of items per page.","name":"count","default":100,"in":"query","required":false,"type":"integer"}},"responses":{"ErrorResponseAuthentication":{"description":"Authorization required","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":401,"message":"Authorization required"}}},"ErrorResponseEmployeeNotFound":{"description":"Employee not found","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":404,"message":"Employee not found"}}},"ErrorResponseEmployeeAvailabilityNotFound":{"description":"Employee availability relationship not found","schema":{"$ref":"#/definitions/ErrorResponse"},"examples":{"application/json":{"code":404,"message":"Employee availability relationship not found"}}}},"definitions":{"BranchSummary":{"description":"Branch summary","type":"object","properties":{"id":{"type":"integer","description":"ID of the branch","example":1},"name":{"type":"string","description":"Name of the branch","example":"Headquarters"}}},"EmployeeDetails":{"description":"Employee details","type":"object","properties":{"id":{"type":"integer","description":"AlayaCare ID of the employee","example":1},"external_id":{"type":"string","description":"External ID of the employee","example":"external_id_1"}}},"AvailabilityTypeDetails":{"description":"Availability type details","type":"object","properties":{"id":{"type":"integer","description":"ID of the availability type","example":1},"name":{"type":"string","description":"Name of the availability type","example":"Availability"}}},"AvailabilitiesList":{"allOf":[{"$ref":"#/definitions/PaginatedList"}],"description":"List of an employee availabilities","type":"object","properties":{"items":{"type":"array","items":{"allOf":[{"$ref":"#/definitions/Availability"}]}}},"required":["items"]},"Availability":{"description":"Availability details","type":"object","properties":{"id":{"type":"integer","description":"ID of the availability","example":1},"employee":{"$ref":"#/definitions/EmployeeDetails"},"availability_type":{"$ref":"#/definitions/AvailabilityTypeDetails"},"description":{"type":"string","description":"Free text comment on the employee availability","example":"Daily availability used for preferred working hours."},"duration":{"type":"integer","description":"Availability duration in minutes. The duration will be set to 0 for an all day availability","example":60},"all_day":{"type":"boolean","description":"Specifies if the availability is applicable for the entire day","example":false},"rrule":{"type":"string","description":"Recurrence rule applied to the employee availability, configured based on the below parameters:\n  - `FREQ` is mandatory and can only be set to `DAILY`,`WEEKLY`or`MONTHLY`.\n  - `DTSTART` is mandatory\n    - The format will be ISO 8601 converted to employee timezone\n  - `UNTIL` is not mandatory\n    - The format will be ISO 8601 converted to employee timezone\n  - `INTERVAL` is mandatory.\n    - When `FREQ` is set to `DAILY`, `INTERVAL` can be set to a value between `1` to `365`\n    - When `FREQ` is set to `WEEKLY`, `INTERVAL` can be set to a value between `1` to `52`\n    - When `FREQ` is set to `MONTHLY`, `INTERVAL` can be set to a value between `1` to `12`\n  - `BYDAY` is mandatory and can only be set when `FREQ` is set to `WEEKLY`. `BYDAY` can be set to either `MO`,`TU`,`WE`,`TH`,`FR`,`SA`and/or`SU`. If multiple values are selected, separate them with a comma (i.e.: `BYDAY=TU,TH,SA`)\n  - `BYMONTHDAY` is mandatory and can only be set when `FREQ` is set to `MONTHLY`. `BYMONTHDAY` can be set to a value between `1` to `28`.\n  - `TIMEZONE` is the timezone of the employee.\n  - `WKST` is the day on which the workweek starts. It must be one of the `MO`,`TU`,`WE`,`TH`,`FR`,`SA`, or`SU`, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is `MO`.\n\nRefer to https://tools.ietf.org/html/rfc5545 for more information.\n","example":"FREQ=DAILY;WKST=MO;DTSTART=20200130T050000Z;UNTIL=20200130T050000Z;INTERVAL=1;TIMEZONE=America/Toronto"},"branch":{"$ref":"#/definitions/BranchSummary"}}},"AvailabilityCreate":{"description":"Availability creation details","type":"object","required":["all_day","rrule"],"properties":{"availability_type_id":{"type":"integer","description":"ID of the Availability Type associated with this availability.\nOptional; if omitted the availability will be created with the system default Availability Type.\n","example":1},"description":{"type":"string","description":"Free text comment on the employee availability","example":"Weekly availability for preferred working hours."},"duration":{"type":"integer","description":"Availability duration in minutes. The duration can only be set when `all_day` is set to `false`","example":60},"all_day":{"type":"boolean","description":"Specifies if the availability is applicable for the entire day","example":false},"rrule":{"type":"string","description":"Recurrence rule applied to the employee availability, configured based on the below parameters:\n  - `FREQ` is mandatory and can only be set to `DAILY`,`WEEKLY`or`MONTHLY`.\n  - `DTSTART` is mandatory\n    - The format must be ISO 8601 and must be sent in the specific employee timezone\n    - The time specified in `DTSTART` represents the start time of the availability. The end time of the availability will be calculated using the `duration`\n  - `UNTIL` is not mandatory\n    - The format must be ISO 8601 and must be sent in the specific employee timezone\n  - `INTERVAL` is mandatory.\n    - When `FREQ` is set to `DAILY`, `INTERVAL` can be set to a value between `1` to `365`\n    - When `FREQ` is set to `WEEKLY`, `INTERVAL` can be set to a value between `1` to `52`\n    - When `FREQ` is set to `MONTHLY`, `INTERVAL` can be set to a value between `1` to `12`\n  - `BYDAY` is mandatory and can only be set when `FREQ` is set to `WEEKLY`. `BYDAY` can be set to either `MO`,`TU`,`WE`,`TH`,`FR`,`SA`and/or`SU`. If multiple values are selected, separate them with a comma (i.e.: `BYDAY=TU,TH,SA`)\n  - `BYMONTHDAY` is mandatory and can only be set when `FREQ` is set to `MONTHLY`. `BYMONTHDAY` can be set to a value between `1` to `28`.\n  - `WKST` is the day on which the workweek starts. It must be one of the `MO`,`TU`,`WE`,`TH`,`FR`,`SA`, or`SU`, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is `MO` if not sent.\n\nRefer to https://tools.ietf.org/html/rfc5545 for more information.\n","example":"FREQ=WEEKLY;WKST=MO;DTSTART=20200211T180000Z;UNTIL=20200303T180000Z;INTERVAL=1;BYDAY=TU,TH,SA"}}},"AvailabilityUpdate":{"description":"Availability update details","type":"object","properties":{"availability_type_id":{"type":"integer","description":"ID of the Availability Type associated with this availability.\nOptional; if omitted, the current availability type remains unchanged.\n","example":1},"description":{"type":"string","description":"Free text comment on the employee availability","example":"Monthly availability for preferred working hours."},"duration":{"type":"integer","description":"Availability duration in minutes. The duration can only be updated when `all_day` is set to `false`","example":60},"all_day":{"type":"boolean","description":"Specifies if the availability is applicable for the entire day","example":false},"rrule":{"type":"string","description":"Recurrence rule applied to the employee availability, configured based on the below parameters:\n  - `FREQ` is mandatory and can only be set to `DAILY`,`WEEKLY`or`MONTHLY`.\n  - `DTSTART` is mandatory\n    - The format must be ISO 8601 and must be sent in the specific employee timezone\n    - The time specified in `DTSTART` represents the start time of the availability. The end time of the availability will be calculated using the `duration`\n  - `UNTIL` is not mandatory\n    - The format must be ISO 8601 and must be sent in the specific employee timezone\n  - `INTERVAL` is mandatory.\n    - When `FREQ` is set to `DAILY`, `INTERVAL` can be set to a value between `1` to `365`\n    - When `FREQ` is set to `WEEKLY`, `INTERVAL` can be set to a value between `1` to `52`\n    - When `FREQ` is set to `MONTHLY`, `INTERVAL` can be set to a value between `1` to `12`\n  - `BYDAY` is mandatory and can only be set when `FREQ` is set to `WEEKLY`. `BYDAY` can be set to either `MO`,`TU`,`WE`,`TH`,`FR`,`SA`and/or`SU`. If multiple values are selected, separate them with a comma (i.e.: `BYDAY=TU,TH,SA`)\n  - `BYMONTHDAY` is mandatory and can only be set when `FREQ` is set to `MONTHLY`. `BYMONTHDAY` can be set to a value between `1` to `28`.\n  - `WKST` is the day on which the workweek starts. It must be one of the `MO`,`TU`,`WE`,`TH`,`FR`,`SA`, or`SU`, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is `MO` if not sent.\n\nRefer to https://tools.ietf.org/html/rfc5545 for more information.\n","example":"FREQ=MONTHLY;WKST=MO;DTSTART=20200211T180000Z;UNTIL=20200303T180000Z;INTERVAL=1;BYMONTHDAY=8"}}},"AvailabilityCreated":{"description":"Availability created details","type":"object","required":["id"],"properties":{"id":{"type":"integer","description":"ID of the availability","example":1}}},"ErrorResponse":{"description":"Error response","type":"object","properties":{"code":{"type":"integer","description":"Response code"},"message":{"type":"string","description":"Detailed error message"}},"required":["code","message"]},"PaginatedList":{"description":"Base model of all paginated lists","type":"object","properties":{"count":{"type":"integer","description":"Number of items in the response","example":1},"items_per_page":{"type":"integer","description":"Number of items in the current page response","example":1},"page":{"type":"integer","description":"Current page number","example":1},"total_pages":{"type":"integer","description":"Total number of pages availbale","example":1}},"required":["count","items_per_page","page","total_pages"]}},"host":"virtserver.swaggerhub.com","basePath":"/alayacare-e8f/employee-availability-api-external/1.0.0"}