OCS Out-of-office API
New 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:
GETEndpoint:
/{userId}- Response:
- Status code:
200 OKOut-of-office data404 Not FoundIf 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 |
|
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 |
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:
GETEndpoint:
/{userId}- Response:
- Status code:
200 OKOut-of-office data404 Not FoundIf 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 |
Modify out-of-office data
It is only possible to modify out-of-office data of the currently logged in user.
Method:
POSTEndpoint:
/{userId}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 |
- Response:
- Status code:
200 OKUpdated out-of-office data400 Bad RequestIf the first day is not before the last day401 UnauthorizedIf 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 |
Clear data and disable out-of-office
It is only possible to clear out-of-office data of the currently logged in user.
Method:
DELETEEndpoint:
/{userId}- Response:
- Status code:
200 OKOut-of-office data was cleared401 UnauthorizedIf the user is not logged in