Users¤
List all your LumApps platform users¤
To list the users of your platform we'll use the /user/list endpoint.
To get all users at once you can use the get_call
method provided by the BaseClient.
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
users = client.get_call("user/list")
You can also add additional parameters according to the documentation
For instance, if you want to list the users of your platform but filter only the ones that are enabled you will do
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
users = client.get_call("user/list", status="enabled")
iter_call
method.
Get a particular user¤
To get a particular user you can do:
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
email = "<the_user_email>"
user = client.get_call("user/get", email=email)
Get the authenticated user¤
To get the user authenticated by the token you provided to the BaseClient you can do:
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
me = client.get_call("user/get")
Create a new user¤
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
body = {
"email": "test@test.com",
"accountType": "external"
}
saved_user = client.get_call("user/save", body=body)
Update an existing user¤
To update an existing user the best pratice is to get it, modify it and then save it.
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
# Get tge user
email = "<user_email>"
user = client.get_call("user/get", email=email)
# Update it
user["firstName"] = "Jacques"
# save it
saved_user = client.get_call("user/save", body=user)
Deactivate a user¤
To deactivate a user you need to set his status to disabled
from lumapps.api.base_client import BaseClient
client = BaseClient(token="<your_token>")
# Get tge user
email = "<user_email>"
user = client.get_call("user/get", email=email)
# Update his status
user["status"] = "disabled"
# save it
saved_user = client.get_call("user/save", body=user)