EndPreviousNextEnd EndPrint This TopicEnd

CreateUser

The CreateUser webservice is used to create a new Contegro user.

 

This will typically be used in a "Registration form" situation where people are creating accounts for themselves, but it could also be used for a system where managers can create accounts for their employees etc.

 

The main bit of data which is passed to this webservice is the userDataJson field. This is a list of element ids and values , where the element ids match the ids which are returned from the GetFormFields webservice call.

 

An example of some userDataJson data is as follows...

{

    'EmailAddress'             : 'steve@contegro.com' ,

    'FirstName'                : 'Steve'                 ,

    'LastName'                 : 'Developer'                 ,

    'Password'                 : '123456'

}

 

If you pass the logInAfterCreating value as true, a user account will be created and the webservice will return an authentication token which is associated with the user account, and which has the same IP address and expiry benefits as the authentication tokens which are described in the LogInUser webservice documentation.

 

Data to be passed to the webservice

Variable name

Data type

Description

formName

String

The name of the Contegro form. This should be the same form name which you used in the GetFormFields webservice call. For the registration form, use Registration

userDataJson

String

A JSON list of element ids and values. Please see the example above

logInAfterCreating

Bool

If you want the user to be logged in after creating their account, set this value to true. The data which is returned will contain an authentication token which is associated to the user account, doesn't have IP address restrictions, and has a very long expiry time. Please see the LogInUser webservice documentation for more information about this

authToken

String

The authentication token for your session

 

Data which is returned

Variable name

Data type

Description

token

String

The auth token which you can use when calling the other APIs. If you had set logInAfterCreating to true, this will be the same kind of token which LogInUser returns (ie: not restricted to an IP address, long expiry date). If you had set logInAfterCreating to false, this will be the same authentication token which you used to make the CreateUser request

expiryDate

DateTime

The date and time that the auth token will stop working

errorCode

String

If your request was successful, the errorCode will be 0

If your request had a problem, there will be an error code for each kind of problem

errorMessage

String

A description of the problem with your error request (if there was a problem)

If your request was successful, this will be an empty string

 

Example XML for a CreateUser request

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

 <soap:Body>

         <CreateUser xmlns="http://contegro.com/">

                 <authToken>0b4a9d95-3c34-4701-9aa3-1056412e1109</authToken>

                 <formName>Registration</formName>

                 <userDataJson>

                         {

                                 'EmailAddress'             : 'steve@contegro.com' ,        

                                 'FirstName'                : 'Steve'                 ,        

                                 'LastName'                 : 'Developer'                 ,        

                                 'Password'                 : '123456'

                         }

                 </userDataJson>

                 <logInAfterCreating>true</logInAfterCreating>

         </CreateUser>

 </soap:Body>

</soap:Envelope>

 

 

Example XML which is returned

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <soap:Body>

         <CreateUserResponse xmlns="http://contegro.com/">

                 <CreateUserResult>

                         <errorCode>0</errorCode>

                         <errorMessage/>

                         <token>0edcdfd3-d959-4f93-91e2-7daba2bc3b34</token>

                         <expiryDate>2021-01-27T14:14:18.2164897+13:00</expiryDate>

                 </CreateUserResult>

         </CreateUserResponse>

 </soap:Body>

</soap:Envelope>

Topic Link