# Updates an absence period by ID. Updates an absence period by ID. # OpenAPI definition ```json { "openapi": "3.0.3", "info": { "title": "Absence Period API", "version": "2.0.0", "description": "Read API for Absence Entities." }, "servers": [ { "url": "https://api.personio.de" } ], "security": [ { "BearerAuth": [] } ], "tags": [ { "name": "Absence Periods", "description": "Endpoints related to absences taken by employees and the rules that define them." } ], "paths": { "/v2/absence-periods/{id}": { "patch": { "summary": "Updates an absence period by ID.", "description": "Updates an absence period by ID.", "tags": [ "Absence Periods" ], "parameters": [ { "$ref": "#/components/parameters/AbsencePeriodId" }, { "$ref": "#/components/parameters/SkipApprovalQueryParam" } ], "x-path-examples": { "204 Valid request": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "400 Invalid JSON": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "403 Forbidden": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "404 Not found": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "409 Absence period conflict": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "409 Requesting absence while substituting": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" }, "422 Unprocessable absence period request": { "value": "/papi/v2/absence-periods/fd19f19d-a272-4ea5-b46a-07ecdfc05be3", "query": "skip_approval=false" } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PatchAbsencePeriodRequest" }, "examples": { "204 Valid request": { "$ref": "#/components/examples/PatchAbsencePeriodRequest" }, "400 Invalid JSON": { "value": { "random": "INVALID_JSON" } }, "403 Forbidden": { "$ref": "#/components/examples/PatchAbsencePeriodRequest" }, "404 Not found": { "$ref": "#/components/examples/PatchAbsencePeriodRequest" }, "409 Absence period conflict": { "$ref": "#/components/examples/PatchAbsencePeriodRequest" }, "409 Requesting absence while substituting": { "value": { "starts_from": { "date_time": "2022-01-01T00:00:00.000", "type": "FIRST_HALF" }, "ends_at": { "date_time": "2022-01-03T00:00:00.000", "type": "SECOND_HALF" } } }, "422 Unprocessable absence period request": { "value": { "starts_from": { "date_time": "2022-01-05T00:00:00.000", "type": "FIRST_HALF" }, "ends_at": { "date_time": "2021-01-01T00:00:00.000", "type": "FIRST_HALF" } } } } } } }, "responses": { "204": { "description": "Successful update.", "x-response-example": "204 Valid request" }, "400": { "$ref": "#/components/responses/BadRequestInvalidJsonErrorResponse" }, "403": { "$ref": "#/components/responses/ForbiddenErrorResponse" }, "404": { "$ref": "#/components/responses/ResourceNotFound" }, "409": { "$ref": "#/components/responses/AbsencePeriodConflictErrorResponse" }, "422": { "$ref": "#/components/responses/AbsencePeriodUnprocessableErrorResponse" } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer" } }, "examples": { "PatchAbsencePeriodRequest": { "value": { "starts_from": { "date_time": "2022-01-01T00:00:00.000", "type": "FIRST_HALF" }, "ends_at": { "date_time": "2022-01-03T00:00:00.000", "type": "SECOND_HALF" }, "comment": "A valid comment" } } }, "parameters": { "AbsencePeriodId": { "name": "id", "in": "path", "description": "The ID of the absence period.", "required": true, "example": "493eff0a-2c5a-467e-8966-f70b4e3805a6", "schema": { "type": "string" } }, "SkipApprovalQueryParam": { "name": "skip_approval", "in": "query", "description": "If true, skip any approval that this write request would otherwise require.", "required": false, "schema": { "type": "boolean", "default": false, "example": false } } }, "schemas": { "DateTimeWithoutTimezone": { "type": "string", "example": "2022-01-01T14:00:00.000", "description": "An RFC3339 date and timestamp without a timezone offset." }, "PatchAbsencePeriodRequest": { "type": "object", "description": "A request to update an absence period.", "properties": { "starts_from": { "description": "This object represents the beginning of the absence period. See the documentation of `AbsencePeriod` for\na full description of these fields.\n", "type": "object", "required": [ "date_time" ], "nullable": true, "properties": { "date_time": { "$ref": "#/components/schemas/DateTimeWithoutTimezone" }, "type": { "type": "string", "nullable": true, "enum": [ "FIRST_HALF", "SECOND_HALF" ], "example": "SECOND_HALF", "description": "Determines whether this period starts from the first half or second half of the day. See the description\nof the `starts_from` field for a detailed explanation.\n" } } }, "ends_at": { "description": "This object represents the end of the absence period. See the documentation of `AbsencePeriod` for a full\ndescription of these fields.\n", "type": "object", "required": [ "date_time" ], "nullable": true, "properties": { "date_time": { "$ref": "#/components/schemas/DateTimeWithoutTimezone" }, "type": { "type": "string", "nullable": true, "enum": [ "FIRST_HALF", "SECOND_HALF" ], "example": "FIRST_HALF", "description": "Determines whether this period ends after the first half or second half of the day. See the\ndescription of the `starts_from` field for a detailed explanation.\n" } } }, "comment": { "type": "string", "nullable": true, "maxLength": 2000, "description": "A comment attached to this period.", "example": "Going on vacation to Hawaii." } } } }, "responses": { "BadRequestInvalidJsonErrorResponse": { "description": "Bad request.", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/ForbiddenErrorResponse/content/application~1problem%2Bjson/schema" }, "examples": { "400 Invalid JSON": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Input must be valid JSON", "detail": "The provided input is not a JSON object" } ] } } } } } }, "AbsencePeriodConflictErrorResponse": { "description": "Conflict.", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/ForbiddenErrorResponse/content/application~1problem%2Bjson/schema" }, "examples": { "409 Absence period conflict": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Overlapping absence period", "detail": "Absence period overlaps with at least one existing period" } ] } }, "409 Requesting absence while substituting": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Requesting an absence while substituting for another absence", "detail": "Requesting an absence while substituting for another absence" } ] } }, "409 Substitute is invalid": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Substitute is invalid", "detail": "Your selected substitute is not available in the selected time period." } ] } } } } } }, "AbsencePeriodUnprocessableErrorResponse": { "description": "Unprocessable request.", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/ForbiddenErrorResponse/content/application~1problem%2Bjson/schema" }, "examples": { "422 Unprocessable absence period request": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Time frame end is before start", "detail": "Time frame end is before time frame start" } ] } }, "422 Substitute not allowed": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Substitute not allowed", "detail": "A substitute is not allowed for this absence type." } ] } }, "422 Substitute required": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Substitute required", "detail": "A substitute is required for this absence type." } ] } } } } } }, "ResourceNotFound": { "description": "Resource not found.", "content": { "application/problem+json": { "schema": { "description": "This object is used to describe the use case where a specific requested resource does not exist.", "x-papi-gateway-errors": [ { "code": "common.requested_resource_not_found", "description": "The requested resource was not found. The resource could have been deleted or never existed in our system\"" } ], "properties": { "schema": { "$ref": "#/components/responses/ForbiddenErrorResponse/content/application~1problem%2Bjson/schema" } } }, "examples": { "404 Not found": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Resource not found", "detail": "The requested resource was not found. The resource could have been deleted or never existed in our system.", "type": "https://developer.personio.de/reference/errors#common.requested_resource_not_found" } ] } } } } } }, "ForbiddenErrorResponse": { "description": "Access to this endpoint is denied.", "content": { "application/problem+json": { "schema": { "type": "object", "description": "This object represents an error response.", "properties": { "personio_trace_id": { "type": "string", "example": "aswo3f-a202lfso-312123sld-1230ddd", "description": "A unique ID that was created for this error." }, "timestamp": { "type": "string", "format": "date-time", "example": "2021-05-28T11:17:30.000Z", "description": "The timestamp of when the error occurred." }, "errors": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string", "example": "Not found", "description": "The title of the error." }, "detail": { "type": "string", "example": "The requested resource was not found.", "description": "A short description about the error." }, "type": { "type": "string", "format": "uri", "example": "https://developer.personio.de/reference/errors#common.requested_resource_not_found", "description": "A link to the developer hub where more information can be found for the encountered error." }, "_meta": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "examples": { "403 Forbidden": { "value": { "personio_trace_id": "8b46fa09-d8fe-4de0-be03-f0a1d48df766", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Access Denied", "detail": "Access to this endpoint is denied." } ] } } } } } } } } } ```