Creating user via API.

Creating user via API.



Creating user via API.



Introduction

Welcome, this is a tutorial to login via API



Parameters


URL
Require Authentication
Method HTTP
/api/v1/users.create

yes
POST


Variables

Note: To save customFields, you must first define customFields in the admin panel (Accounts -> Registration -> Custom Fields).


Arguments
Examples
Required
Description
email
Required

The user's email address.


name
Username
Required

The user's display name.


password

pass@w0rd


Required

The user's password.


username

myuser
Required

The username of the user.


active

false


Default optional:  true


Whether the user is active, which determines whether he can login or not.

roles

['bot']


Default optional: ['user']


The roles the user assigned to them at creation.

joinDefaultChannels
false

Default optional: true


Whether the user should join the default channels when created.

requirePasswordChange
true

Default optional: false


Should the user be asked to change their password when logging in?

sendWelcomeEmail
true

Default optional : false


Should the user receive a welcome email?

verified
true

Default optional : false


Should the user's email address be verified when created?

customFields

{ twitter: '@example' }


Default optional : undefined


Any custom fields the user must have in their account.


Call Example


  1. curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application / json" \
     https://<myoffice>.myhive.global/api/v1/users.create \
     -d '{"name": "name", "email": " email@user.tld ", "password": "anypassyouwant", "username": "uniqueusername"}'

Result:
  1. {
           "user" : {
           "_id" : "BsNr28znDkG8aeo7W" ,
          "createdAt" : "2016-09-13T14: 57: 56.037Z" ,
          "services" : {
          "password" : {
          "bcrypt" : "$ 2a $ 10 $ 5I5nUzqNEs8jKhi7BFS55uFYRf5TE4ErSUH8HymMNAbpMAvsOcl2C"
                            }
                                 } ,
          "username" : " unique username" ,
          "emails" : [
                                          {
          "address" : " email@user.tld " ,
          "verified" : false
                                          }
            ] ,
         "type" : "user" ,
         "status" : "offline" ,
         "activate" : true  ,
         "functions" : [
         "of the user"
          ] ,
         "_updatedAt" : "2016-09-13T14: 57: 56.175Z"
        "name" : "name"
        "settings" : { }
                     } ,

    "success" : true

    }
Observation:

customFields will not be returned if they do not exist on the server.

In case of doubts or suggestions, please contact our support via e-mail: suportebr@myhive.global













    • Related Articles

    • Disable users via API.

      Disable users via API. Introduction Welcome, this is a tutorial to disable user via API. Note: Disable inactive users. Permission required:    edit-other-user-active-status. Parameters URL Require Authentication Method HTTP ...
    • Set status via API

      Set status via API. Introduction Welcome, this is a tutorial to help set status via API. Defines a user status when status message and status are provided. Arguments: URL Require Authentication Method HTTP /api/v1/users.setAvatar yes POST  Payloads ...
    • Translate message via API

      Translate message via API. Introduction Welcome, this is a tutorial to translate a message via API. Translate the message provided. Arguments URL Require Authentication Método HTTP /api/v1/autotranslate.translateMessage yes POST  Payloads Argument ...
    • Set Avatar Image via API

      Set Avatar Image via API. Introduction Welcome, this is a tutorial to set avatar image via API. Uploading a file. Arguments: URL Require Authentication Method HTTP /api/v1/users.setAvatar yes POST Payloads Arguments Example Required Description image ...
    • List users and information via API

      List users and information via API Introduction Welcome, this is a tutorial to list users and their information via API. Listing Gets all users in the system and their information, the result is limited only to what the receiver has access to view. ...