Login API
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Login API

  • Dark
    Light
  • PDF

Article summary

Logs in to the Planful Web Service application to perform data import / export operations.

Syntax

LoginResult = api.Login(String LoginName, String LoginPassword, String TenantCode)

Usage

Use the Login call to log in to the Planful Web Service application and start a Client session. A Client application must log in and obtain a session ID before making any other API calls.

When a Client application invokes the Login call, it passes in a user name and password and tenant code. Upon invocation, the Planful Web Service authenticates the login and returns the session ID for the session, the user ID associated with the logged in user name, to use in all subsequent API calls.

After logging in, a Client application needs to set the session ID in the SOAP header so that the Planful Web Service can validate subsequent requests for this session.

Note:
Can you obtain login credentials from the Web Service Access - Configuration Tasks application page. For tenant code, contact Support if you do not already have it. Changes to either the Login or Password for the Web Services API will impact existing integrations that are using the same credentials and as such should be changed with caution.

Development tools differ in the way you specify session headers. For more information, see the documentation for your particular development tool.

Client applications do not need to explicitly log out to end the session. Sessions expire automatically after a predetermined length of time which is 120 minutes (two hours).

Arguments List

The following table provides a list of arguments that are required for the Load_Data method call:

NameTypeDescription

LoginName

LoginPassword

TenantCode

String

String

String

User login name

User login password

Tenant code for connecting to the tenant application

Response

LoginResult

The Login method call returns LoginResult object which contains the status of method call and session id for making subsequent API calls in case of successful login.

Sample Code

Private Sub Login()
Dim api As New HostAPI()
Dim strSessionId As String = "", strTenantCode As String = "", objLoginResult As LoginResult
Try
'User login/pwd for the API access and the tenant code
		strLogin = "admin@planful.com"
		strPWD = "password"
		strTenantCode = "MoonPie"
'Instantiate the authentication header object to accept the session ID from the web method after sucessful login
		api.AuthenticationHeaderValue = New AuthenticationHeader
'Call the web method to login the Planful web server API
		objLoginResult = api.Login(strLogin, strPWD, strTenantCode)
If objLoginResult.Success Then
'Assign the session ID in login result object to API objects authenticatio header.  This is to pass the session ID as SOAP header for authentication in subsequent API calls
			api.AuthenticationHeaderValue.SessionId =
			objLoginResult.sessionId
End If
		Console.WriteLine(objLoginResult.message)
Catch ex As Exception
End Try
End Sub

Was this article helpful?