To connect to a JobTracker instance, you need the URL of the JobTracker server along with a username and password.
The URL for the API ends with "api.aspx", while the regular JobTracker application web page ends in "d.asp" for the desktop web page or "m.asp" for the mobile web page.
Example #1: The URL for the online demo is: http://demo.moraware.net/demo/api.aspx
Example #2: The URL for a typical JobTracker server not hosted on moraware.net is: http://myServerName/JobTracker/api.aspx
The UserName and Password can be any JobTracker user who has security permissions to execute API requests. (i.e. The user must be an Administrator or be associated with a Role that has the Execute API Requests permission set.)
.NET Object Model
For the .NET object model, you interact with the server through the Connection object. The first step is to create a Connection object and connect to the server using the URL/UserName/Password. Then you can call methods on the Connection object to interact with the server.
To log out of the session you can call the Disconnect method. If you don't call this method, the session will eventually time out based on the "Session Timeout" setting on the System Settings page in JobTracker.
VB.NET Example:
Imports Moraware.JobTrackerAPI3 Public Class APISample Private conn As New Connection Private Sub ConnectToJobTracker() If Not conn.Connected() Then conn.Url = "http://myServerName/JobTracker/api.aspx" conn.UserName = "myUserName" conn.Password = "myPassword" conn.Connect() End If End Sub Private Sub DisconnectFromJobTracker() If conn.Connected() Then conn.Disconnect() End If End Sub End Class
XML
For the XML interface, interactions with the server are done by posting an XML request to the server over HTTP, and receiving an XML response back. Every request must contain the API version number, and (other than the initial sessionCreate request) a Session Id. The sessionCreate request takes the userName and password as parameters and returns a sessionId, which is then used for subsequent requests.
The sessionCreate response also includes the accepted encoding of gzip, which means that you can gzip the requests you send to the server. To receive gzipped responses back, you should set the HTTP header: "Accept-Encoding: gzip" to let JobTracker know it's safe to compress the response. It is highly recommended that you gzip requests and responses when using the XML interface to minimize the amount of data sent over the network.
To log out of the session you can call the sessionLogout command. If you don't call this command, the session will eventually time out based on the "Session Timeout" setting on the System Settings page in JobTracker.
Request:
<MorawareCommand version="3" userName="myUserName" password="myPassword"> <sessionCreate /> </MorawareCommand>
Response:
<MorawareResponse version="3"> <sessionCreate> <session id="mySessionId"> <acceptedRequestContentEncodings> <encoding>gzip</encoding> </acceptedRequestContentEncodings> </session> </sessionCreate> </MorawareResponse>
Request:
<MorawareCommand version="3" sessionId="mySessionId"> <sessionLogout /> </MorawareCommand>
Response:
<MorawareResponse version="3"> <sessionLogout /> </MorawareResponse>