Page tree
Skip to end of metadata
Go to start of metadata

You can add a user with a POST request to the following URL: /user.

Permissions to run the request: Account Owner, Administrators, Department Administrators.

Department Administrators can add users only to the department they manage and its sub-departments.

 

Request Headers

ParameterDescription
X-Auth-Account-Url (required)The base URL of the account, e.g. http://myaccount.ispringlearn.com
X-Auth-Email (required)

The login of Account Owner, Administrator, or Department Administrator.

X-Auth-Password (required)The password of Account Owner, Administrator, or Department Administrator.
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: true)The parameter that determines whether an email is sent to the added user.
invitationMessage (optional)The text of an invitation message in the email.
role (required)

The user might be assigned to one of the roles:

learner
publisher
department_administrator
administrator

groups (optional)An array with the IDs of the groups the user will be added to.

manageableDepartmentIds (required if the user's role is department_administrator or publisher)

An array with the IDs of the departments the user will manage if their role is Department Administrator or Publisher.

As soon as the request is successfully processed, the system returns code 201. Response body will contain ID of the added user. 

The role parameter might take one of the following values:

  • learner
  • administrator
  • department_administrator
  • publisher

 

Possible Response Codes

CodeTextDescription
201Successful operationA new user has been added.
400Bad RequestSome of the sent parameters are incorrect.
401UnauthorizedAn authorization error.
403Permission Denied

The user doesn't have enough permissions to add another users. For instance, Department Administrators can't add users to a department they don't manage.

 

Sample Request

POST /user HTTP/1.1
Host: api-learn.ispringlearn.com
X-Auth-Account-Url: https://myaccount.ispringlearn.com
X-Auth-Email: owner
X-Auth-Password: 12345Q
Content-Type:application/xml
 
<?xml version="1.0" encoding="UTF-8"?>
<request>
    <departmentId>1b7270ce-5cf5-11e9-a78e-0a580af40692</departmentId>
    <password>12345Q</password>
    <fields>  
       <login>new_user</login>
       <email>kate@gmail.com</email>
       <first_name>Kate</first_name>
       <last_name>Smith</last_name>
       <job_title>Sales Manager</job_title>
    </fields>  
    <role>department_administrator</role>
    <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>
    <sendLoginEmail>true</sendLoginEmail>
    <invitationMessage>string</invitationMessage>
</request>

Sample Response

HTTP/1.1 201 Successful operation
Connection: close
 
<?xml version="1.0" encoding="UTF-8"?>
<user_id>string</user_id>
  • No labels