CreateUser

Creates a new user.

URI POST rest/v1/users

Returns – A UserResponse containing a User Object in the Users array.  (See RequestResponse in Appendix B)

Parameters

Name Type Description
encryptedToken string Required. Encrypted Token returned from
client authentication. Returns null if
token has expired or is invalid.
salt string Required. Any combination of text and
numbers that was used to encrypt the
plain text password into
encryptedPassword.
user User Required. User Object.

 

Example – C#

[gdlr_notification icon=”none” type=”color-border” border=”#31BEF9″ color=”#000000″]
string uri = “rest/v1/users”;
string salt = “Z1s6aXNQpjQ75wRX1ulI551sR1uHyg3YsOcPLeL9TaM”;
string responseString = string.Empty;
JavaScriptSerializer jss = new JavaScriptSerializer();
UserResponse userResponse;

User createUser = new User();
createUser.FirstName = “FirstName”; //Required field
createUser.LastName = “LastName”; //Required field
createUser.Username = “UserName”; //Required field
createUser.Password = encryptedPassword; //Required field
createUser.Company = “Company name”;
createUser.Region = string.Empty;
createUser.SubscriptionTypes = “Annual”;
createUser.TimeZoneId = “Pacific Standard Time”;
createUser.StatusCode = UserStatusCodes.Active;

var data = new
{
salt= salt,
user= createUser
};
string json = serializer.Serialize(data);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(host + uri);
request.Headers.Add(“Authorization” , encryptedToken);
request.Method = “POST”;
request.ContentType = “application/json”;

using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write(json);
}

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
userResponse = jss.Deserialize<UserResponse>(responseString);

[/gdlr_notification]