How to set status in NC 20 through API?

Heya!

I’d like to make an API call to my NC20 to set my status. I haven’t found a suitable endpoint in th edocs, though. Could somebody point me to the right direction please?

-Stefan

See the apps/user_status/lib/Controller/StatusesController.php class and the original PR at https://github.com/nextcloud/server/pull/21186. I don’t think there is a public API right now.

Ah, OK… Thanks!

Get current status

curl --location --request GET 'https://cloud.test/ocs/v2.php/apps/user_status/api/v1/user_status' \ --header 'OCS-APIREQUEST: true' \ --header 'Authorization: Basic xxx' \

Set predefined status

curl --location --request PUT 'https://cloud.test/ocs/v2.php/apps/user_status/api/v1/user_status/status' \ --header 'OCS-APIREQUEST: true' \ --header 'Authorization: Basic xxx ' \ --header 'Content-Type: application/json' \ --data-raw '{ "statusType": "dnd" }'

To use a custom status use the network inspector and see what request is done by Nextcloud. Have fun :wink:

1 Like