owncloud / docs-ocis

ownCloud oCis Admin Documentation
https://doc.owncloud.com
8 stars 7 forks source link

Document: how to get the ID of a user #918

Open mmattel opened 4 months ago

mmattel commented 4 months ago

We have docs how to get a space ID, but not how to get a user ID. (section maintenance) A user ID is used e.g. in search, reindex a space.

As an admin you can get the id of a user with the graph api:

curl https://cloud.ocis.test/graph/v1.0/users/einstein -u admin:admin -k -s

{"accountEnabled":true,"displayName":"Albert Einstein","givenName":"Albert","id":"4c510ada-c86b-4815-8820-42cdf82c3d51","onPremisesSamAccountName":"einstein","surname":"Einstein"}

in pretty by piping to jq:

curl https://cloud.ocis.test/graph/v1.0/users/einstein -u admin:admin -k -s | jq

{ "accountEnabled": true, "displayName": "Albert Einstein", "givenName": "Albert", "id": "4c510ada-c86b-4815-8820-42cdf82c3d51", "onPremisesSamAccountName": "einstein", "surname": "Einstein" }

or only the raw id

curl https://cloud.ocis.test/graph/v1.0/users/einstein -u admin:admin -k -s | jq '.id' -r

4c510ada-c86b-4815-8820-42cdf82c3d51

obviously the authentication should be a jwt token in production ;-)

Note, using the auth-app makes authentication using a token easier...