Creating users
m |
(Created page with "### Tutorial There are two types of users in a DreamFactory 2.0 instance - Admins and Users (non-admins). Admins are part of system and uses the API api/v2/system/admin. Use...") |
||
Line 1: | Line 1: | ||
− | + | ### Tutorial | |
+ | |||
+ | There are two types of users in a DreamFactory 2.0 instance - Admins and Users (non-admins). Admins are part of system and | ||
+ | uses the API api/v2/system/admin. Users are part of the df-user (https://github.com/dreamfactorysoftware/df-user) package | ||
+ | and uses the API api/v2/user. This tutorial will go over creating both Admins and Users using admin console as well as the | ||
+ | API endpoints. | ||
+ | |||
+ | ### Creating Admins | ||
+ | |||
+ | Log into the admin console and click on the 'Admins' tab. From there click on the 'Create' button from the left menu. Fill out | ||
+ | the new admin form and click on the 'Create' form button. You must ben an admin to create another admin account. | ||
+ | |||
+ | #### API Endpoint | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?session_token=<jwt_for_an_admin_session></pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "display_name", | ||
+ | "first_name": "user_first_name", | ||
+ | "last_name": "user_last_name", | ||
+ | "email": "email_address", | ||
+ | "password": "password" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | Note: Session token can also be supplied using X-DreamFactory-Session-Token request header. | ||
+ | |||
+ | #### Example - Creating an Admin | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?session_token=abc.123.efg</pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "John", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe", | ||
+ | "email": "jdoe@example.com", | ||
+ | "password": "secret" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | ### Creating Users | ||
+ | |||
+ | Log into the admin console and click on the 'Users' tab. From there click on the 'Create' button from the left menu. Fill out | ||
+ | the new user form and click on the 'Create' form button. You can send out an email invitation to the new user by checking off | ||
+ | the 'Send Email Invitation' checkbox before creating the user. If you send out email invitation then there is no need to | ||
+ | manually set the password as the user will create his/her own password using the invitation email. You need to be an admin | ||
+ | or a user with role-service access to 'POST api/v2/user' API to create another user. | ||
+ | |||
+ | #### API Endpoints | ||
+ | |||
+ | With email invitation | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?send_invite=true&session_token=<jwt_for_an_user_session_with_proper_role></pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "display_name", | ||
+ | "first_name": "user_first_name", | ||
+ | "last_name": "user_last_name", | ||
+ | "email": "email_address" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | Without email invitation | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?session_token=<jwt_for_an_user_session_with_proper_role></pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "display_name", | ||
+ | "first_name": "user_first_name", | ||
+ | "last_name": "user_last_name", | ||
+ | "email": "email_address", | ||
+ | "password": "password" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | Note: Session token can also be supplied using X-DreamFactory-Session-Token request header. | ||
+ | |||
+ | #### Example - Creating an User | ||
+ | |||
+ | With email invitation | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?send_invite=true&session_token=<abc.123.efg></pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "John", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe", | ||
+ | "email": "jdoe@example.com" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | Without email invitation | ||
+ | |||
+ | <pre>POST https://your-url/api/v2/system/admin?session_token=<abc.123.efg></pre> | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "resource": [ | ||
+ | { | ||
+ | "name": "John", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe", | ||
+ | "email": "jdoe@example.com", | ||
+ | "password": "secret" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </source> |
Revision as of 15:00, 12 October 2015
- Tutorial
There are two types of users in a DreamFactory 2.0 instance - Admins and Users (non-admins). Admins are part of system and uses the API api/v2/system/admin. Users are part of the df-user (https://github.com/dreamfactorysoftware/df-user) package and uses the API api/v2/user. This tutorial will go over creating both Admins and Users using admin console as well as the API endpoints.
- Creating Admins
Log into the admin console and click on the 'Admins' tab. From there click on the 'Create' button from the left menu. Fill out the new admin form and click on the 'Create' form button. You must ben an admin to create another admin account.
- API Endpoint
POST https://your-url/api/v2/system/admin?session_token=<jwt_for_an_admin_session>
{ "resource": [ { "name": "display_name", "first_name": "user_first_name", "last_name": "user_last_name", "email": "email_address", "password": "password" } ] }
Note: Session token can also be supplied using X-DreamFactory-Session-Token request header.
- Example - Creating an Admin
POST https://your-url/api/v2/system/admin?session_token=abc.123.efg
{ "resource": [ { "name": "John", "first_name": "John", "last_name": "Doe", "email": "jdoe@example.com", "password": "secret" } ] }
- Creating Users
Log into the admin console and click on the 'Users' tab. From there click on the 'Create' button from the left menu. Fill out the new user form and click on the 'Create' form button. You can send out an email invitation to the new user by checking off the 'Send Email Invitation' checkbox before creating the user. If you send out email invitation then there is no need to manually set the password as the user will create his/her own password using the invitation email. You need to be an admin or a user with role-service access to 'POST api/v2/user' API to create another user.
- API Endpoints
With email invitation
POST https://your-url/api/v2/system/admin?send_invite=true&session_token=<jwt_for_an_user_session_with_proper_role>
{ "resource": [ { "name": "display_name", "first_name": "user_first_name", "last_name": "user_last_name", "email": "email_address" } ] }
Without email invitation
POST https://your-url/api/v2/system/admin?session_token=<jwt_for_an_user_session_with_proper_role>
{ "resource": [ { "name": "display_name", "first_name": "user_first_name", "last_name": "user_last_name", "email": "email_address", "password": "password" } ] }
Note: Session token can also be supplied using X-DreamFactory-Session-Token request header.
- Example - Creating an User
With email invitation
POST https://your-url/api/v2/system/admin?send_invite=true&session_token=<abc.123.efg>
{ "resource": [ { "name": "John", "first_name": "John", "last_name": "Doe", "email": "jdoe@example.com" } ] }
Without email invitation
POST https://your-url/api/v2/system/admin?session_token=<abc.123.efg>
{ "resource": [ { "name": "John", "first_name": "John", "last_name": "Doe", "email": "jdoe@example.com", "password": "secret" } ] }