OCS Out-of-office API
Added in version 28.0.
The OCS Out-of-office API allows you to access and modify out-of-office data of users.
The base URL for all calls to the share API is: <nextcloud_base_url>/ocs/v2.php/apps/dav/api/v1/outOfOffice
All calls to OCS endpoints require the OCS-APIRequest
header to be set to true
.
Fetch ongoing data
Fetch data of the ongoing out-of-office period of a user.
Method:
GET
Endpoint:
/{userId}/now
- Response:
- Status code:
200 OK
Out-of-office data404 Not Found
If the user does not have an ongoing out-of-office period
Data (is only sent if the status code is
200 OK
):
field |
type |
Description |
|
string |
Database ID of the absence data entity |
|
string |
ID of the user which the data belongs to |
|
int |
Timestamp of the start date (respecting the userId’s timezone) |
|
int |
Timestamp of the end date (respecting the userId’s timezone) |
|
string |
Short text that is set as user status during the absence |
|
string |
Longer multiline message that is shown to others during the absence |
|
string/null |
ID of the replacement user |
|
string/null |
Displayname of the replacement user |
Fetch upcoming or ongoing data
The returned out-of-office period might not have started yet. This endpoint will return data of the ongoing or next upcoming out-of-office period of a user.
Method:
GET
Endpoint:
/{userId}
- Response:
- Status code:
200 OK
Out-of-office data404 Not Found
If the user did not schedule an out-of-office period
Data (is only sent if the status code is
200 OK
):
field |
type |
Description |
|
int |
Database ID of the absence data entity |
|
string |
ID of the user which the data belongs to |
|
string |
First day of the absence in format |
|
string |
Last day of the absence in format |
|
string |
Short text that is set as user status during the absence |
|
string |
Longer multiline message that is shown to others during the absence |
|
string/null |
ID of the replacement user |
|
string/null |
Displayname of the replacement user |
Modify out-of-office data
It is only possible to modify out-of-office data of the currently logged in user.
Method:
POST
Endpoint:
/
Data:
field |
type |
Description |
|
string |
First day of the absence in format |
|
string |
Last day of the absence in format |
|
string |
Short text that is set as user status during the absence |
|
string |
Longer multiline message that is shown to others during the absence |
|
string/null |
ID of the replacement user |
|
string/null |
Displayname of the replacement user |
- Response:
- Status code:
200 OK
Updated out-of-office data400 Bad Request
If the first day is not before the last day404 Not Found
If a replacement user ID is provided but no corresponding user is found401 Unauthorized
If the user is not logged in
Data (is only sent if the status code is
200 OK
):
field |
type |
Description |
|
int |
Database ID of the absence data entity |
|
string |
ID of the user which the data belongs to |
|
string |
First day of the absence in format |
|
string |
Last day of the absence in format |
|
string |
Short text that is set as user status during the absence |
|
string |
Longer multiline message that is shown to others during the absence |
|
string/null |
ID of the replacement user |
|
string/null |
Displayname of the replacement user |
Clear data and disable out-of-office
It is only possible to clear out-of-office data of the currently logged in user.
Method:
DELETE
Endpoint:
/
- Response:
- Status code:
200 OK
Out-of-office data was cleared401 Unauthorized
If the user is not logged in