Create users using API
A guide on how to create users with our API
Overview
Prerequistes
Example
Environment Setup
pip install requestsSource Code
import requests # pip install requests
user_endpoint = 'https://app.neowit.io/api/user/v1/user'
token='' # add token here
def create_user(access_token):
data = {
'email': '[email protected]',
'name': 'testuser321',
'locale': 'en-US',
'role': 'ROLE_MEMBER', # ROLE_MEMBER or ROLE_ADMIN
'timezone': 'Europe/Oslo',
'idpId': '', # blank if username/password
}
return requests.post(
url=user_endpoint,
headers={
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json',
},
json=data,
)
def main():
print(create_user(token).json())
if __name__ == '__main__':
main()Customizing user authentication
Last updated