Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If the username does not exist in the MyAlerts database To subscribe a User to a Layer Group you will need to call the SetUserLayerGroup method to add the user.

SetUserLayerGroup

Input Parameters

The SetUserLayerGroup method needs the following parameters:

CreateUser Input parametersImage Removed

ClientId. 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

...

Returned Parameters

The following parameters will be returned:

...

.

UserId

mandatory

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

LayerGroupId

mandatory

This is the unique id for the LayerGroup to which you wish to subscribe the user.

MapSourceId

mandatory

This is the unique id for the MapSource.

LocationId

mandatory

This is the unique id for the Location.

Name

Requirement

Description

Returns

Code Block
languagexml
titleSyntax
<SetUserLayerGroupResult>
	<Error>
		<Code>string</Code>
        <Description>string</Description>
  
     </Error>
       
<UserId>int</UserId>         <Success>boolean</SuccessSuccess>
</CreateUserResult>SetUserLayerGroupResult>

 

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

1005 – Email address already exists

1006 – Username already exists

1007 – Error creating user

1023 – Required fields incomplete

UserId

...

Success

This will be either True or False. If False an error message will be provided in the Error result, if True the UserId user will be providedsubscribed to the layer group.

Code Examples

C#

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

...

Code Block
languagec#
titleC# Example
linenumberstrue
UserManager.UserManager umws = new UserManager.UserManager();
// [Client Id] and [Session Key] are returned using the 'Create client Session KeyCreateSessionKey' method
// Possible layergroups to subscribe to can be derived using the getlayersGetLayers method
UserManager.DatabaseWriteResult result = 
	umws.SetUserLayerGroup(	[ClientId],
							"[SessionKey]",
							[UserId],
							"[LayerGroupGUID]",
							"[MapSourceGUID]",
							"[LocationGUID]");
return result.Success;

...

Code Block
languagec#
titleC# Example
linenumberstrue
UserManager.UserManager umws = new UserManager.UserManager();
// [Client Id] and [Session Key] are returned using the 'Create client Session KeyCreateSessionKey' method
// Possible layergroups to subscribe to can be derived using the getlayersGetLayers method
UserManager.DatabaseWriteResult result = 
	umws.SetUserLayerGroup(	2, 
							"f3abb2f2-ce86-4971-b6ae-d72661191670",
							1,
							"4582862c-8a53-464d-832b-facaead9b524",
							"9209617d-a21b-4945-b45d-424a026417bd",
							"3802a7ef-0afc-4127-aaf8-660e49444c01");
return result.Success;

...