Define Location information for a User

To set the Location information for a User you will need to call the SetLocationValues method. 

This method is available to developers from the UserManager.asmx Web Service. 

Parameters

 

ClientId

mandatory

This is the id for the client that was returned by the CreateSessionKey method.

SessionKey

mandatory

This is the SessionKey for the client that was returned by the CreateSessionKey method.

UserId

mandatory

This is the unique user id for the user as stored in the My Alerts database.

LocationId

mandatory

This is a unique identifier for the the location record.

LocationName

mandatory

This is a text field, usually containing the address - for example "22, TANGLEWOOD CLOSE, WOKING, SURREY, GU22 8LG"

DistancemandatoryThis is the distance in metres.  If a change falls within this range, a user will receive an alert.
ActivemandatorySets the record as 1=Active or 0=Inactive.

Name

Requirement

Description

Returns

Syntax
      <SetLocationValuesResult>
        <Error>
          <Code>string</Code>
          <Description>string</Description>
        </Error>
        <Success>boolean</Success>
      </SetLocationValuesResult>

Error- Code / Description

An error code and description if the call to the web service is unsuccessful and the Success if False.

1001 – Invalid Session key provided

Success

This will be either True or False. If False an error message will be provided in the Error result, if True the location values will be updated.

Code Examples

C#

Add a web reference to the usermanager.asmx web service using the Visual Studio IDE.

C# Example
// Explanation of webservice parameters
// [ClientId] and [SessionKey] are returned from the CreateSessionKey method
// LocationId is a unique identifier for the the location record 
//     - see the myalert.tbl_locations table locationid column
//     - it is also the returned value from the AddLocation method 
// "[LocationName]" is a text field, usually containing the address
//     - for example "22,  TANGLEWOOD CLOSE, WOKING, SURREY, GU22 8LG"
// [Distance] - A float value, value in metres. If a change falls within
//     - this range, a user will receive an alert
// [Active] - 1=Active 0=Inactive
UserManager.DatabaseWriteResult res2 = umws.SetLocationValues(	[ClientId], 
																"[SessionKey]",
																[userid],
																"[LocationId]",
																"[LocationName]", 
																[Distance],
																[Active]);
 
if (res2.Success)
    Response.Write("Success");
else
    Response.Write("Fail");

Python

Python Example
import suds
url = "http://[PATH TO WEBSERVICE]/usermanager.asmx?wsdl"
client = suds.client.Client(url)
result = client.service.SetLocationValues(	[ClientId],
											["SessionKey"], 
											[userid],
											"[LocationId]",
											"[LocationName]",
											[Distance],
											[Active]);
 
if result.Success:
  print "Success"
else:
  print "Fail"