Versions Compared

Key

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

If the username does not exist in the MyAlerts database you will need to call the SetUserLayerGroup method to add the user.

...

The SetUserLayerGroup method needs the following parameters:

CreateUser Input parametersImage RemovedImage Added

ClientId

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

SessionKey

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

UserId

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

LayerGroupId

This is the unique id for the LayerGroup.

MapSourceId

This is the unique id for the LayerGroup.

LocationId

This is the unique id for the Location.

Returned Parameters

The following parameters will be returned:

Code Block
<CreateUserResult>      <SetUserLayerGroupResult>
        <Error>
          <Code>string</Code>
          <Description>string</Description>
        </Error>
        <UserId>int<<Success>boolean</UserId>Success>
        <Success>boolean</Success
</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

This is the UserId that has been generated for the supplied Username in the MyAlerts database and will only be returned if the Success is True.

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;

...