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 share 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 ——|------|————-|---------------|
statusType| string | New status for the authenticated user |online,away,dnd,invisible,offline|- 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 ——|------|————
messageId| string | Message-Id of the predefined messageclearAt| 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 ——|------|————
statusIcon| string/null | The icon picked by the user (must be an emoji, at most one)message| string | The custom message picked by the userclearAt| 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 ——|------|————
limit| int | Limit for paginationoffset| 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
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}