Skip to content
On this page

User-Related Code Samples

GetUsers()

csharp
var req = new UserDetailsRequestModel() 
{
    IDs = new List<object> 
    { 
        123
    }
};

var api = new UsersUpdateableApi(myRestEndpointUrl);
var results = api.GetUsers(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    //do work...
}
else
{
    //handle error
}

InsertUsers()

csharp
var req = new UserInsertRequestModel() 
{
    Users = new List<object> 
    { 
        new UserInsertModel()
        {
            ProntoID = "MyAccountName",
            Username = "johnsmith",
            FirstName = "John",
            LastName = "Smith",
            EmailAddress = "john.smith@your-domain.com",
            SecurityQuestion = "What is you favorite color?",
            SecurityAnswer = "Blue.  No, I mean yellow... ahhhh!!",
            Password = "p@ssword123"
        }
    }
};

var api = new UsersApi(myRestEndpointUrl);
var results = api.InsertUsers(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    //do work...
}
else
{
    //handle error
}

GetUsersUpdateable()

csharp
var req = new UserUpdateableRequestModel() 
{
    IDs = new List<object> 
    { 
        123
    }
};

var api = new UsersUpdateableApi(myRestEndpointUrl);
var results = api.GetUsersUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    //do work...
}
else
{
    //handle error
}

UpdateUsers()

csharp
var req = new UserUpdateableRequestModel() 
{
    IDs = new List<object> 
    { 
        123
    }
};

var api = new UsersUpdateableApi(myRestEndpointUrl);
var results = api.GetUsersUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    results.UpdateableUsers[0].LastName = "UPDATED!";
	var updateModel = new UserUpdateRequestModel() 
	{
	    Users = results.UpdateableUsers
	};
    
    var api = new UsersApi(myRestEndpointUrl);
	var updateResults = api.UpdateUsers(sa, updateModel);
	if (updateResults.IsSuccessful)
	{
		//do work...
	}
	else
	{
	    //handle error
	}
}
else
{
    //handle error
}

DeleteUsers()

csharp
var req = new UserDeleteRequestModel()
{
    Users = new List<object>
    { 
        new UserDeleteModel()
        {
            ID = 123
        }
    }
};

var api = new UsersApi(myRestEndpointUrl);
var results = api.DeleteUsers(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    //do work...
}
else
{
    //handle error
}