Managing the Session

The following methods control a Web Service session.

Starting a Session

The AFA SOAP API uses sessions to avoid re-authenticating with every request. You obtain a session key with the connect method. This session key is used in all other SOAP API requests.

Request Type: ConnectRequest

Element

Type

Description

UserNameMandatory

String

AFA username.

PasswordMandatory

String

AFA password.

DomainOptional

String

Domain name.

Relevant only when domains are enabled.

Default: 0

ImpersonateUserOptional

Sting

Username of the user you want to impersonate.

The option to impersonate a user is only available for administrator users. The UserName and Password must be administrator credentials.

Response Type: ConnectResponse

Element

Type

Description

SessionIDMandatory

String

On success, returns the session ID.

On failure, throws a standard SOAP fault.

Request example:

<ConnectRequest>
    <UserName>admin</UserName>
    <Password>admin_password</Password>
</ConnectRequest>

Response example:

<ConnectResponse>
    <SessionID>8cea15d11c4aa8eb338ce5c4a91e69ea</SessionID>
</ConnectResponse>

Verifying a Session is Active

To verify that your session has not timed out, use the is_session_alive method.

Request Type: IsSessionAliveRequest

Element

Type

Description

SessionIDMandatory

String

Session ID received in connect request.

Response Type: IsSessionAliveResponse

Element

Type

Description

IsSessionAliveResponse

Integer

If the session is active, 1; otherwise, 0.

Request example:

<IsSessionAliveRequest>
    <SessionID>107220f9f300f936cf743ee29bea9d38</SessionID>
</IsSessionAliveRequest>

Response example:

<IsSessionAliveResponse>1</IsSessionAliveResponse>

Ending a Session

When a session is completed, you must terminate your session using the disconnect method.

Request Type: DisconnectRequest

Element

Type

Description

SessionIDMandatory

String

Session ID received in connect request.

Response Type: DisconnectResponse

Element

Type

Description

DisconnectResponse

Integer

If the session was terminated successfully, 1; otherwise, 0.

Request example:

<DisconnectRequest>
    <SessionID>8cea15d11c4aa8eb338ce5c4a91e69ea</SessionID>
</DisconnectRequest>

Response example:

<DisconnectResponse>1</DisconnectResponse>