I want to get user id only for specific users instead of all

api_token = “”
session = APISession(api_token)
for user in session.iter_all(“users”):
print(user[“id”], user[“email”], user[“name”])

This code iterts to all the users and provide their id, email and name
I want just for specific users can you pls tell how can i. do that

whats the use case here? you can just go to the UI and select the user and it will show you in the URL their PD ID. If you want to use it for programmatic purposes I suggest getting this great utility PD-CLI (which will let you do what you want and much more):

Hi Asha.

The /users/ endpoint only supports retrieving an individual user’s information or retrieving the whole list of users.

If you already know their user ids, you can iterate over those using session.get, session.rget, or session.jget if you’re using pdpyras.

There is not a search endpoint in the API, so if you don’t know the user ids, it’s much harder to get what you need, especially if you have a lot of users. You can use the iterator, but you’d need to do the matching on your own.

You can use the CLI for these tasks as well. The default output isn’t particularly helpful for programmatic use, but with --output you should be able to get json, yaml, or csv formatted data.