Reputation: 1765
I am using box api integration to my app, I am facing an issue with fetching a single user data, I am an enterprise admin and I am getting all the users list when I use GET /users
api. How can I take the single user out of this when I pass the login param of the User object. Any ideas ?
Upvotes: 0
Views: 240
Reputation: 8025
You can fetch a single user by using the filter_term
query parameter to match all or part of the user's login (docs):
curl https://api.box.com/2.0/users?filter_term=prats
-H "Authorization: Bearer ACCESS_TOKEN"
Response:
{
"total_count": 1,
"entries": [
{
"type": "user",
"id": "123456",
"name": "prats",
"login": "[email protected]",
...
}
]
}
Be aware that filter_term
matches the beginning of the login string. If you have multiple users with names that start the same way, e.g. prats
and prats2
, the above request will return both of them. To prevent this, specify the entire login, or simply append an @
to the end of the filter_term
value:
curl https://api.box.com/2.0/users?filter_term=prats@
-H "Authorization: Bearer ACCESS_TOKEN"
Upvotes: 1