OCS Status API
The OCS Status API allows you to access and modify status API from outside over pre-defined OCS calls.
The base URL for all calls to the Status API is: <nextcloud_base_url>/ocs/v2.php/apps/user_status/api/v1/user_status
All calls to OCS endpoints require the OCS-APIRequest header to be set to true.
User Status - Status Manipulation
Fetch your own status
Required capability:
user_statusMethod:
GETEndpoint:
/- Response:
- Status code:
200 OK404 Not FoundIf the user does not have a status set
Set your own status
Required capability:
user_statusMethod:
PUTEndpoint:
/statusData:
field |
type |
Description |
Allowed values |
|
string |
New status for the authenticated user |
|
- Response:
- Status code:
200 OK400 Bad RequestIf the sent status-type is not valid
Set a custom message (predefined)
Required capability:
user_statusMethod:
PUTEndpoint:
/message/predefinedData:
field |
type |
Description |
|
string |
Message-Id of the predefined message |
|
int |
Unix Timestamp representing the time to clear the status |
- Response:
- Status code:
200 OK400 Bad RequestIf the sent messageId does not exist400 Bad RequestIf the Unix timestamp is in the past
Set a custom message (user-defined)
Required capability:
user_status,supports_emojiforstatusIconsupportMethod:
PUTEndpoint:
/message/customData:
field |
type |
Description |
|
string/null |
The icon picked by the user (must be an emoji, at most one) |
|
string |
The custom message picked by the user |
|
int |
Unix Timestamp representing the time to clear the status |
- Response:
- Status code:
200 OK400 Bad RequestIf the statusIcon is not a an emoji or more than one emoji400 Bad RequestIf the message is too long400 Bad RequestIf the Unix timestamp is in the past
Clear message
Required capability:
user_statusMethod:
DELETEEndpoint:
/message- Response:
- Status code:
200 OK
User Status - Predefined statuses
Base endpoint ics: /ocs/v2.php/apps/user_status/api/v1/predefined_statuses
Fetch the list of predefined statuses
Required capability:
user_statusMethod:
GETEndpoint:
/- Response:
- Status code:
200 OK
User Status - Retrieve statuses
Base endpoint ics: /ocs/v2.php/apps/user_status/api/v1/statuses
Fetch a list of all set user-statuses
Required capability:
user_statusMethod:
GETEndpoint:
/Data:
field |
type |
Description |
|
int |
Limit for pagination |
|
int |
Offset for pagination |
- Response:
- Status code:
200 OK
Fetch a specific user’s status
Required capability:
user_statusMethod:
GETEndpoint:
/{userId}- Response:
- Status code:
200 OK404 Not FoundIf the user does not have a status set
Fetch a user’s backup status
In some scenarios the user’s status can be overwritten automatically, e.g. by joining a call in Nextcloud Talk,
or when the availability automation is enabled. In this case the userId can be prefixed with an _ underscore,
to get the original user status. When a user status is returned and the user_status > restore capability
is available, the backup status should be added as an item in the predefined status list. Clicking that should then
do an API call to User status - Restore backup should be done.
Required capability:
user_statusMethod:
GETEndpoint:
/_{userId}- Response:
- Status code:
200 OK404 Not FoundIf the user does not have a backup status set
Files Sharing
- The user-status is also exposed via the following Files Sharing APIs:
GET /ocs/v2.php/apps/files_sharing/api/v1/shareesGET /ocs/v2.php/apps/files_sharing/api/v1/sharees_recommendedGET /ocs/v2.php/apps/files_sharing/api/v1/sharesGET /ocs/v2.php/apps/files_sharing/api/v1/shares/inheritedGET /ocs/v2.php/apps/files_sharing/api/v1/shares/pendingGET /ocs/v2.php/apps/files_sharing/api/v1/shares/{id}POST /ocs/v2.php/apps/files_sharing//api/v1/sharesPUT /ocs/v2.php/apps/files_sharing/api/v1/shares/{id}
User status - Restore backup
Required capability:
user_status>restoreMethod:
DELETEEndpoint:
/revert/{messageId}- Response:
- Status code:
200 OK