createCustomer (String username, String emailAddress, String firstname, String lastname, HashMap fieldValues)
This API is used to create new customers in Service Desk.
If the Create Account option is enabled in the application’s setup, this function does not require the User to be logged in.
The following are the input parameters for this API:
username: A new user name for this account.
emailAddress: Email address for this user.
firstname: First name of the user.
lastname: Last name of the user.
fieldValues: HashMap of the field values to populate this new account with.
NOTE:All four input parameters are mandatory and have to be unique. Omitting any of these will result in a failure message explaining the cause.
This API returns a HashMap containing two fields: success and message.
The values returned in the two fields of the HashMap are:
The value returned in the success field will be a string representation of a boolean (true or false) indicating whether or not the Customer creation attempt was successful.
The value returned in the message field will be a String representation of the new Customer’s ID number.
NOTE:Make a note of the returned customer number for subsequent web service requests.
findCustomer (String emailAddress)
findCustomer (String firstname, String lastname)
findCustomer (String emailAddress, String firstname, String lastname)
findCustomer (String username, String emailAddress, String firstname, String lastname, HashMap customFields)
This API is used to search for a Customer.
The following are the input parameters for this API:
Username: User name for this search. It can be either an LDAP user name or a System user name, which uses Service Desk’s built-in authentication.
emailAddress: Email address for this search.
firstname: First name of user to search for.
lastname: Last name of user to search for.
customFields: HashMap of field values to locate this customer.
This API returns a HashMap which contains a list of HashMap for each entry. The key of the first map is the Customer ID of the returned user, the HashMap for that entry contains four string fields representing the Customer’s Last Name, Org Unit, Primary E-mail Address and First Name. A null is permitted when using multiple parameter based functions.
function findUser($username,$email,$first,$last) { global $objClient; global $baseService; //switch to the customer api $objClient->SoapClient($baseService . "Customer?wsdl", array('trace' => true)); echo "Searching for " . $username . $email . $first . $last . "n"; # Call findCustomer, using an email address and echo out response # username, email, first, last $results = $objClient->findCustomer($username,$email,$first,$last); $success = $results['success']; if ($success=="false") { echo $results['message'] . "n"; return; } # if we have results lets show them # returns an array of arrays foreach(array_values($results) as $ess) { print_r($ess); }}
deleteCustomerById (String customerId)
deleteCustomerByUsername (String username)
This API is used to delete a Customer. The Customer ID or User name is required and the account will be locked out if the request is successful.
The following are the input parameters for this API:
customerId: The unique customer ID of the account.
username: The unique user name of the account.
This API returns a HashMap containing the success flag and a message if the request was unsuccessful.
undeleteCustomerById (String customerId)
undeleteCustomerByUsername (String username)
This API is used to undelete a customer. The Customer ID or user name is required and the account will be re- activated if the request is successful.
The following are the input parameters for this API:
customerId: The unique customer ID of the account.
username: The unique user name of the account.
This API returns a HashMap containing the success flag and a message if the request was unsuccessful.
getFieldsForCustomer (String customerId)
This API is used to get the Customer details to the logged in user, based on the supplied Customer ID.
The following are the input parameters for this API:
customerId: The unique customer ID of the account.
The returned HashMap contains fields that the system knows about the user like First Name, Last Name, Username and contact information.
Note that phone2 refers to the mobile/cell phone number in the LiveTime user interface, and phone3 refers to the fax number as defined in the GUI.
Custom Fields are defined in the administration area of Service desk. When retrieving these fields, they will be returned with the label defined in the custom field, but when calling update methods, these must be passed using the underlying variable name, being custom1 through custom5.
getCountries ()
This API is used to return a list of all the Countries.
None
This API returns a HashMap which contains another HashMap for each entry. The key of the first map is the Country ID of the returned Country, the Map for that entry contains two string fields representing the Country Name and Top Level Domain (TLD).
getStatesForCountry (String countryId)
This API is used to search for states or provinces of a Country.
The following are the input parameters for this API:
countryId: The unique country ID.
This API returns a HashMap containing the State ID and the State Name for each State of the searching Country.
findCountry (String countryName, String tld)
This API is used to search for a Country, based on either the Country Name or Top Level Domain.
The following are the input parameters for this API:
countryName: The unique country name for the search.
tld: The unique Top Level Domain used for the search.
This API returns a HashMap containing another HashMap for the Country. The key of the first map is the Country ID of the returned Country, the Map for that entry contains two string fields representing the Country Name and Top Level Domain.
updateCustomerById (String customerId, HashMap values)
updateCustomerByUsername (String username, HashMap values)
This API allows logged in users to update Customer information.
The following are the input parameters for this API:
customerId: The unique customer ID for the account.
username: The unique user name for the account.
values: The HashMap of values to set for this customer.
The fields returned from the ‘get’ equivalent (firstname, lastname, email, address, city, state, etc) can all be inserted into the HashMap that is sent to LiveTime to set new values for those fields.
The returned HashMap will contain success and message values.
The values HashMap is a map of Strings to Strings. Valid keys for Customer web services are the same as those returned in the getFieldsForCustomer method, specifically: firstName, lastName, userName, password, email, orgUnit, address, addressTwo, city, state, country, postalCode, phone, phone2, phone3, webAccess, aliases, emailNotify.
All values should be strings, webAccess and emailNotify should be a 1 or a 0 expressed as a String, and aliases can be a comma-separated list.
updateLocation (String latitude, String longitude)
This API allows logged in users to update their geographical coordinates by specifying latitude and longitude values.
The following are the input parameters for this API:
latitude: The geographical latitude coordinate of the logged in account.
longitude: The geographical longitude coordinate of the logged in account.
None
getGeoLocation (String customerId)
This API retrieves the geo location for the given customer ID.
The following are the input parameters for this API:
customerId: The unique customer Id for the account.
None