Client API
The client API is a module that can be included directly in your application to be used to interact with the TACTIC API.
Although you could still use this, it is now more popular to use the REST API simply because with REST, you can use any programming language that has the ability to make http calls (whih is basically every programming langage).
The Client API has been around for a long time, so it's documentation is included here.
Settting up the TACTIC server stub
let server = TACTIC.get();
let my_site = "trial";
let my_project = "trial_api";
server.set_server("https://portal.southpawtech.com");
server.set_site(my_site);
server.set_site(my_project);
server.set_ticket(authentication_ticket);
Once this is setup, future calls to the TACTIC.get() will retrieve this same server stub.
Multiple Server Stubs
While TACTIC.get() will get the default stub, it is possible to have multiple stubs to different TACTIC servers (or sites or projects).
let server1 = TACTIC.get("server1");
let server2 = TACTIC.get("server2");
Each stub will connect to the respective server.
Advantages of using the Client API
In some ways, making client_api is cleaner that the REST calls:
For example to make a query with a simple filter using the client API:
let server = TACTIC.get();
let search_type = "worfklow/job";
let filters = [['status', 'In Progress']];
let jobs = server.query(search_type, filters);
With REST, the equivalent code would look like:
let search_type = "worfklow/job";
let filters = [['status', 'In Progress']];
let kwargs = {
search_type: search_type,
filters: filters
}
let jobs = call_tactic("query", kwargs);
Note
With the REST example, we are hiding all of the details of the actual request in a "call_tactic" method which is described in the REST documentation.