Creating users

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsCreating users
m
(Example - Creating an Admin)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Discovering how you can sleep better is very important, as not sleeping might cause various major health issues. The fact is that there are various people who are not sleeping well in the evening, so you could also realize that your concentration is reduced, your mind feels fuzzy, and your body just won't respond as well as usual. <br><br>The typical recommendation for the 'good night's sleep' involves  7.5-8.5 hours of sleep. To ensure a fantastic night's sleep, one can take measures to lessen both external stimuli and internal stress, all leading to improved sleep patterns. If you loved this report and you would like to get extra facts regarding [http://mglandscaping.ca/?attachment_id=456 pills to help sleep] that help you sleep ([http://card4myex.com/index.php/en/k2-category/item/9-proin-fringilla-elementum-tortor card4myex.com]) kindly check out the site. A darkened room, free from noise ( let down the telly, power on the  computer games, try meditation, and  turn on soft music) can help reduce stress levels which would [http://todamoderninha.com.br/?p=2452 help with sleeping] in relaxation. A comfortable room temperature, and avoiding caffeine, nicotine and alcohol may also be choices that may reduce stimulation. <br><br>Strange as it might sound, this noisy alarms says he will allow you to sleep better by Playing sound programs to you when you sleep, and boasts eight various sound therapy programs. When it is time to awaken, it plays a recorded voice message to wake you up that lasts 15 seconds. Priced at $99 on Amazon, it's name is Tranquil Moments. This is truly a designer alarm clock with dual clocks plus a calendar. It requires 4 AA batteries or even an AC adapter to be effective.<br><br>Sleeping types or positions vary based on one's preference. Some have returned sleepers and stomach sleepers. They lie on their backs or stomachs and use firm pillows to offer them support while sleeping. The most common of all the so-called sleep types are side sleepers. Specific pillows for side sleepers are recommended to supply them more comfort.<br><br>A side sleeper pillow is softer when compared to traditional soft and chunky pillow. It is a pillow that keeps your neck neutrally aligned while your face rests on its side. It has a raised contour on the bottom edge, where your neck should rest. While on the flatter side in the pillow is made for your face. This type of pillow fits well for the contours of the neck and head, thereby being sure that one's body is properly aligned.
+
There are two types of users in a DreamFactory instance: Admins and Users (non-admins). Admins use the API api/v2/system/admin. Users are part of the df-user (https://github.com/dreamfactorysoftware/df-user) package
 +
and use the API api/v2/system/user.  
 +
 
 +
This tutorial demonstrates how to create Admins and Users using the DreamFactory Admin Console and by using
 +
API endpoints directly.  
 +
 
 +
=== 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 be an admin to create another admin account.
 +
 
 +
==== API Endpoint ====
 +
 
 +
<pre>POST https://{url}/api/v2/system/admin?session_token={jwt_for_an_admin_session}</pre>
 +
Request body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "display_name",          //Required field
 +
      "first_name": "user_first_name",
 +
      "last_name": "user_last_name",
 +
      "email": "email_address",        //Required field
 +
      "password": "password"
 +
    }
 +
  ]
 +
}
 +
</source>
 +
 
 +
 
 +
'''''Note:''' Session token can also be supplied using X-DreamFactory-Session-Token request header.''
 +
 
 +
==== Example - Creating an Admin ====
 +
 
 +
* Session Token: abc.123.efg
 +
* Request body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "John",
 +
      "first_name": "John",
 +
      "last_name": "Doe",
 +
      "email": "jdoe@example.com",
 +
      "password": "secret"
 +
    }
 +
  ]
 +
}
 +
</source>
 +
* Request URL:
 +
<pre>POST https://foo.com/api/v2/system/admin?session_token=abc.123.efg</pre>
 +
 
 +
=== 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
 +
the 'Send Email Invitation' checkbox before creating the user. If you send out email invitation, there's no need to
 +
manually set the password since 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 <code>POST api/v2/system/user</code> API to create another user.
 +
 
 +
==== API Endpoints  ====
 +
 
 +
===== With email invitation: =====
 +
 
 +
<pre>POST https://{url}/api/v2/system/user?send_invite=true&session_token={jwt_for_an_user_session_with_proper_role}</pre>
 +
Request body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "display_name",          //Required field
 +
      "first_name": "user_first_name",
 +
      "last_name": "user_last_name",
 +
      "email": "email_address"          //Required field
 +
    }
 +
  ]
 +
}
 +
</source>
 +
 
 +
===== Without email invitation: =====
 +
 
 +
<pre>POST https://{url}/api/v2/system/user?session_token={jwt_for_an_user_session_with_proper_role}</pre>
 +
Request body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "display_name",          //Required field
 +
      "first_name": "user_first_name",
 +
      "last_name": "user_last_name",
 +
      "email": "email_address",        //Required field
 +
      "password": "password"
 +
    }
 +
  ]
 +
}
 +
</source>
 +
 
 +
 
 +
'''''Note:''' Session token can also be supplied using X-DreamFactory-Session-Token request header.''
 +
 
 +
==== Example - Creating a User  ====
 +
 
 +
===== With email invitation: =====
 +
 
 +
* Session Token: abc.123.efg
 +
* Send Invite: true
 +
* Request Body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "John",
 +
      "first_name": "John",
 +
      "last_name": "Doe",
 +
      "email": "jdoe@example.com"
 +
    }
 +
  ]
 +
}
 +
</source>
 +
* Request URL:
 +
<pre>POST https://foo.com/api/v2/system/user?send_invite=true&session_token=abc.123.efg</pre>
 +
 
 +
 
 +
===== Without email invitation: =====
 +
 
 +
* Session Token: abc.123.efg
 +
* Request Body:
 +
<source lang="JavaScript">
 +
{
 +
  "resource": [
 +
    {
 +
      "name": "John",
 +
      "first_name": "John",
 +
      "last_name": "Doe",
 +
      "email": "jdoe@example.com",
 +
      "password": "secret"
 +
    }
 +
  ]
 +
}
 +
</source>
 +
* Request URL:
 +
<pre>POST https://foo.com/api/v2/system/user?session_token=abc.123.efg</pre>

Latest revision as of 16:41, 15 July 2016

There are two types of users in a DreamFactory instance: Admins and Users (non-admins). Admins use the API api/v2/system/admin. Users are part of the df-user (https://github.com/dreamfactorysoftware/df-user) package and use the API api/v2/system/user.

This tutorial demonstrates how to create Admins and Users using the DreamFactory Admin Console and by using API endpoints directly.

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 be an admin to create another admin account.

API Endpoint

POST https://{url}/api/v2/system/admin?session_token={jwt_for_an_admin_session}

Request body:

{
  "resource": [
    {
      "name": "display_name",           //Required field
      "first_name": "user_first_name",
      "last_name": "user_last_name",
      "email": "email_address",         //Required field
      "password": "password"
    }
  ]
}


Note: Session token can also be supplied using X-DreamFactory-Session-Token request header.

Example - Creating an Admin

  • Session Token: abc.123.efg
  • Request body:
{
  "resource": [
    {
      "name": "John",
      "first_name": "John",
      "last_name": "Doe",
      "email": "jdoe@example.com",
      "password": "secret"
    }
  ]
}
  • Request URL:
POST https://foo.com/api/v2/system/admin?session_token=abc.123.efg

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 the 'Send Email Invitation' checkbox before creating the user. If you send out email invitation, there's no need to manually set the password since 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/system/user API to create another user.

API Endpoints

With email invitation:
POST https://{url}/api/v2/system/user?send_invite=true&session_token={jwt_for_an_user_session_with_proper_role}

Request body:

{
  "resource": [
    {
      "name": "display_name",           //Required field
      "first_name": "user_first_name",
      "last_name": "user_last_name",
      "email": "email_address"          //Required field
    }
  ]
}
Without email invitation:
POST https://{url}/api/v2/system/user?session_token={jwt_for_an_user_session_with_proper_role}

Request body:

{
  "resource": [
    {
      "name": "display_name",           //Required field
      "first_name": "user_first_name",
      "last_name": "user_last_name",
      "email": "email_address",         //Required field
      "password": "password"
    }
  ]
}


Note: Session token can also be supplied using X-DreamFactory-Session-Token request header.

Example - Creating a User

With email invitation:
  • Session Token: abc.123.efg
  • Send Invite: true
  • Request Body:
{
  "resource": [
    {
      "name": "John",
      "first_name": "John",
      "last_name": "Doe",
      "email": "jdoe@example.com"
    }
  ]
}
  • Request URL:
POST https://foo.com/api/v2/system/user?send_invite=true&session_token=abc.123.efg


Without email invitation:
  • Session Token: abc.123.efg
  • Request Body:
{
  "resource": [
    {
      "name": "John",
      "first_name": "John",
      "last_name": "Doe",
      "email": "jdoe@example.com",
      "password": "secret"
    }
  ]
}
  • Request URL:
POST https://foo.com/api/v2/system/user?session_token=abc.123.efg