Creating users

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsCreating users
(Created page with "For a student, poor sleeping habits can be devastating, as they make it hard for you to concentrate at school and even more challenging to study after class. Once you start fi...")
 
(Example - Creating an Admin)
 
(14 intermediate revisions by 5 users not shown)
Line 1: Line 1:
For a student, poor sleeping habits can be devastating, as they make it hard for you to concentrate at school and even more challenging to study after class. Once you start fidgeting, you haven't any doubt wondered about how to nap better, but fat loss time passes, it becomes even more difficult. If you liked this article and you simply would like to acquire more info relating to how do i sleep better ([http://video.prosinger.org/profile.php?u=whatpillshelpyousleep541 video.prosinger.org]) i implore you to visit the site. You might have found it almost impossible to change your brain off after you reach now each day gets a whole lot worse. If you think that this describes your nighttime routine, read on. This is a symbol of insomnia but, luckily, techniques that you can turn things around on the go.<br><br>1. Create a more inviting sleep environment. If your living space is just too bright or too noise, you need to take on the project. Sometimes sleep interruptions are caused by a well used or uncomfortable mattress. Even though you may be in bed for eight hours nightly, you could possibly night be sleeping the whole eight hours as well as the sleep you will get most likely are not deep enough to get beneficial. Make sure your living space is the right temperature and that you remove any distractions from it.<br><br>1. Curb the consequences of jet lag: A few days before a visit, start slowly adjusting your clocks to reflect the time at the destination. You can use the free website Jet Lag Rooster to figure out exactly how to modify your sleep schedule based on how long you will end up traveling and what time zones you're traveling to and from. This helps your body acclimate more naturally to enough time change when you turn up.    <br><br>The last tip would be to remove all electronics before going to fall asleep. Having electronics in the area give you reasons to stay awake. A television keeps providing why you should stay awake in lieu of sleep. Your cell phone will keeps going off and make you awake. If you cellphone or tablet lights up when asleep, it is going to wake you up. Instead of allowing these distractions, just throw them away. Put your TV remote across the room next to the television. Charge your cellphone within the other room. Put your personal machine, or tablet, across the room to [http://showmeyourbibs.com/groups/natural-way-to-get-better-sleep-health/ help me sleep now] you go to nap. Getting rid of this distraction will [http://community-mysexbay.net/top/index.php?a=stats&u=pillsthathelpyousleep8 help with sleep] you to go to rest, and also have a good night's sleep.<br><br>1. The first and oldest way of trying to improve your odds of sleeping can be a warm glass of milk. The fact is that this can trigger certain hormones within you that may [http://social.saaan.org/blog/view/146378/10-sure-fire-ways-to-get-a-better-sleep help me get to sleep] you relax. It won't knock you out, nevertheless it provide started feeling relaxed and ready to sleep. This method only works generally if any devices is good. The remaining 9 things are items that could make the sleep opportunity ideal, so warm milk is best used if every one of these other methods have been used.
+
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