Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Request:   POST /user

Table of Contents
minLevel2

Permissions to Run the Request

...

Department Administrators and users with   a custom role can add users only to the departments they manage and their sub-departments.

Request Headers and Parameters


HeaderDescription
Authorization
 
(required)Access token. You can
 obtain 
obtain a token
 
by making a request
ParameterDescription
email (optional)The email of the new user
login (required)The login of the new user
password (optional)The password of the new user
departmentId (required)The ID of the department the user will be added to
sendLoginEmail (optional, default:
 
false)The parameter that determines whether an email is sent to the added user
invitationMessage (optional, required if the
 
sendLoginEmail parameter is set to
 
true)The text of the email invitation message that is sent to the added user
sendLoginSMS (optional, default:
 
false)The parameter that determines whether an SMS is sent to the added user
invitationSMSMessage (optional, required if the
 
sendLoginSMS parameter is set to
 
true)The text of the SMS that is sent to the added user
role (optional)

If you assign one of

 

the standard roles

 

to the user (except for Account Owner), use one of the following values for the

 

role

 

parameter:

  • account_administrators
  • department_administrators
  • course_authors
  • learners
  • supervisor

Learn more about using the

 

role

 

parameter in the

 

Important

 

section

roleId (required if
 
the
 
custom
 
value is used for the
 
role
 
parameter)

The

 

roleId

 

parameter is used, if you assign

 

the custom roles to the user. In this case, you will need to use the needed role ID for the roleId

 

parameter.

Learn more about using the

 

roleId

 

parameter in the

 

Important

 

section

manageableDepartmentIds (required if the user's role is Department Administrator,

 

or a custom role)

An array with the IDs of the departments the user will manage
groups (optional)An array with the IDs of the groups the user will be added to
roles  (optional)An array of data using which you can assign one or two roles to a user. You will need to use the needed role ID for the roleId
 
parameter inside the array.

If you assign two roles, one of them will be Learner, and the second role — one of the administrative roles (Account Administrator,
 
Department Administrator, or
 
a custom role).

Learn more about using the
 
roles
 
parameter in the
 
Important
 
section

Response Parameters

Parameter

Description

user_id

The ID of the added user


Info

Anchor
Important
Important
Important Info

  1. If in the account there are required user profile fields (apart from the fields of the 'Country' format), they should be also put into the request.

  2. The user role can be assigned in one of two ways:

    1. Using the role

...

    1. (if the assigned role is

...

    1. Account Administrator,

...

    1. Department Administrator, or

...

    1. Learner) and

...

    1. roleId

...

    1. (if the role is

...

    1. a custom role) tags,

    2. Using the

...

    1. roles

...

    1. array of data.

  1. If you use the

...

  1. roles

...

  1. array of data to assign a user role, you will be able to select two roles at once. 

    One of the roles will be Learner and the second role will be one of the administrative roles (Account Administrator,

...

  1. Department Administrator, or

...

  1. a custom role).

    If you add two administrative roles to the roles

...

  1. array of data, the user won't be added.

  2. If you have assigned a user role

...

  1. both

...

  1. with the

...

  1. role/roleId

...

  1. tags and the roles

...

  1. array of data, the user will be assigned to a role or roles specified in the roles

...

  1. array of data and the value specified in the role/roleId

...

  1. tags will be then ignored.

  2. If you haven't specified the user role with the role/roleId

...

  1. tags or with the roles

...

  1. array of data, the user will be assigned to the

...

  1. Learner

...

  1. role. 

Possible Response Codes

CodeTextDescription
200OKA new user has been added. The response body contains the ID of the added user
400Bad RequestSome of the sent parameters are incorrect
401UnauthorizedAn authorization error
403Permission Denied

The user doesn't have enough permissions to add other users. For instance,

 

Department Administrators

 

can't add users to a department they don't manage

Sample Request


Code Block
languagexml
POST /user https/1.1

...


Host: api-learn.ispringlearn.com

...

 
Authorization: p-1sJDjmULL5DdpXPJTcbm4jVIaWVHvNmrjAxATRbNE

...

 
Content-Type:application/xml

...


 
<?xml

...

 version="1.0"

...

 encoding="UTF-8"?>

...


<request>
    <departmentId>1b7270ce-5cf5-11e9-a78e-0a580af40692</

...

departmentId>
    <password>password</password>
    <fields>  
       <login>kate.smith</login>
       <phone>+19101231232</phone>
       <email>kate.smith@ispringsolutions.com</email>
       <first_name>Kate</first_name>
       <last_name>Smith</last_name>
       <job_title>Sales Manager</job_title>
    </fields>  
    <role>custom</role>
    <roleId>209b9312-afb3-11e9-aaf2-dabe560e07b1</

...

roleId>
    <manageableDepartmentIds>
        <id>b00ba37c-5b6f-11e9-bb45-0a580af40556</

...

id>
        <id>aff46554-5b6f-11e9-80e4-0a580af40556</

...

id>
    </manageableDepartmentIds>
    <groupIds>
        <id>270ebbfa-5f6f-11e9-878e-0a580af406fd</

...

id>
    </groupIds>
    <roles>
       <role>
         <roleId>efb18a8e-7be7-11ea-a17c-9e2d25e528cc</

...

roleId>
            <manageableDepartmentIds>
                 <id>783eee2e-7b51-11ea-ae7d-9e2d25e528cc</

...

id>
            </manageableDepartmentIds>
       </role> 
       <role>
          <roleId>eaf02558-2ae1-11e9-8b17-0242ac13000a</

...

roleId> 
       </role> 
    </roles>
    <sendLoginEmail>true</sendLoginEmail>
    <invitationMessage>Please use the following credentials to sign up at iSpring Academy:
    </invitationMessage>
    <sendLoginSMS>true</sendLoginSMS>
    <invitationSMSMessage>Please use the following credentials to sign up at iSpring Academy:
    </invitationSMSMessage>
</request>

Sample Response

Code Block
languagexml
https/1.1 200 OK
 
<?xml 

Sample Response

...

version="1.0"

...

 encoding="UTF-8"?>

...


<response>{user_id string}</

...

response>