(POST) - Create a new User Account
Creating a new User Account is easy - send a POST request to the api/user service with the following key/value pairs:
-
user_name (optional) a user name for the new user account
-
user_email (optional) a unique email address for the new user account
-
password (required) a password for the new user account
Note that you can configure which of the additional fields are required in your Proxima User Global Config from the Jamroom ACP.
So to create a new user account where we have not required a "user_name" or "user_email" would look like:
All we need to pass to the service is a password - if everything goes as planned, you will receive a
201 HTTP Status Code with a note of "user created and session started".
The response will be a JSON response and look similar to:
{
code: 201,
text: 'Created',
note: 'user created and session started',
data:
{
_id: 1245,
session_id: '85983d0cebbf85699081cb3c805a2995',
location: 'http://yoursite.com/api/user/1245'
}
}
Things to note:
- all Proxima responses will have (at minimum) a
code and
text field - in this case a code of "201" means the new user account was "Created".
- there is a "data" object in the response that includes the unique "_id" field - this is the unique user id that was created for this new user account, and should be stored for use on future logins.
- the "session_id" is a unique session identifier that means the user has successfully been logged in to the system. You must
save this value in your client and include it on all future requests as the "password" portion of the HTTP Basic Authentication header.
- the "location" value is the unique URL for actions pertaining to this unique user account (i.e. to retrieve information about, request a password reset, delete the account, etc.)