Creating users

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsCreating 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:
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.
+
### 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

      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.

      1. 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.

        1. 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.

        1. 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"
    }
  ]
}


      1. 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.

        1. 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.

        1. 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"
    }
  ]
}