User Management
Users and Admins can be managed using the /system/user and /system/admin endpoints respectively.
For the below examples, replace user with admin when managing admins.
Get User / Admin Details
Endpoint: GET https://{url}/api/v2/system/user
Curl Equivalent:
curl -X GET "https://{url}/api/v2/system/user" -H "accept: application/json" \
-H "X-DreamFactory-Session-Token: <session_token>"
You can retrieve an individual user / admin's details using the ?ids=<id_number> parameter. If you don't know the id number off hand, you can filter by any field which you do know, such as an email address by using the filter parameter. For example:
https://{url}/api/v2/system/user?filter=email=tomo@example.com
Creating a User / Admin
Without Email Invitation
Endpoint: POST https://{url}/api/v2/system/user
You will need to provide your session token in a X-DreamFactory-Session-Token header.
Request Body:
{
"resource": [
{
"name": "display_name", // Required field
"first_name": "first_name",
"last_name": "user_last_name",
"email": "email_address", // Required field
"password": "password"
}
]
}
Curl Equivalent:
curl -X POST "https://<url>/api/v2/system/user" \
-H "accept: application/json" -H "Content-Type: application/json" \
-H "X-DreamFactory-Session-Token: <sessionToken>" \
-d "{\"resource\":[{\"name\":\"<display_name>\",\"first_name\":\"<first_name>\",\"last_name\":\"<last_name>\",\"email\":\"<email_address>\",\"password\":\"<password>\"}]}"
With Email Invitation
This requires an Invite Email Service and an Invite Email Template to be set on the user service first. Without both, the request returns HTTP 500. See Email Registration and Password Reset.
Endpoint: POST https://{url}/api/v2/system/user?send_invite=true
Request Body:
{
"resource": [
{
"name": "display_name", // Required field
"first_name": "first_name",
"last_name": "user_last_name",
"email": "email_address", // Required field
}
]
}
Curl Equivalent:
curl -X POST "https://<url>/api/v2/system/user?send_invite=true" \
-H "accept: application/json" -H "Content-Type: application/json" \
-H "X-DreamFactory-Session-Token: <sessionToken>" \
-d "{\"resource\":[{\"name\":\"<userName>\",\"first_name\":\"<firstName>\",\"last_name\":\"<lastName>\",\"email\":\"<emailAddress>\"}]}"
Updating a User / Admin
To update a pre-existing User / Admin, a PATCH request can be made referencing the ID of the user to be changed with the ?ids=<ID> parameter. You will need to provide your session token in a X-DreamFactory-Session-Token header.
Endpoint: PATCH https://{url}/api/v2/system/user?ids=<ID_number>
Request Body:
{
"resource": [
{
"field_to_change": "value",
...
}
]
}
Curl Equivalent:
curl -X PATCH "https://{url}/api/v2/system/user?ids=<ID_number>" \
-H "accept: application/json" -H "Content-Type: application/json" \
-H "X-DreamFactory-Session-Token: <session_token>" \
-d "{\"resource\":[{\"<field_to_update\":\"value\"}]}"
Deleting a User / Admin
To delete a pre-existing User / Admin, simply send a delete request with the corresponding user ID by using the ?ids=<ID> parameter.
Endpoint: DELETE https://{url}/api/v2/system/user?ids=<ID_number>
Curl Equivalent:
curl -X DELETE "https://{url}/api/v2/system/user?ids=<ID_number>" \
-H "accept: application/json" -H "Content-Type: application/json" \
-H "X-DreamFactory-Session-Token: <session_token>"