02.05.2013 Views

MKS Integrity 2007 Integrations Builder Guide

MKS Integrity 2007 Integrations Builder Guide

MKS Integrity 2007 Integrations Builder Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: Using the <strong>MKS</strong> API<br />

20<br />

There are also API-specific default preferences that are used in special situations. For<br />

example, the default set of fields shown in a view command in the API are specially defined<br />

as API defaults and are not subject to changes that may be reflected in the GUI.<br />

Executing a Command<br />

The command runner executes the command and passes it to the integration point. The<br />

integration point runs the command and returns a response, which contains all information<br />

related to the execution of the command. The response contents can then be accessed or<br />

another command can be run. Each command execution generates a new response. For more<br />

information on accessing response contents, see “Reading Responses” on page 20.<br />

If a command specified for the Java API ends in an error, a command level exception is<br />

thrown and should be caught. For more information, see “Catching Exceptions” on page 29.<br />

Reading Responses<br />

A response contains all of the output from executing a command. All commands communicate<br />

using the same response type, but use the response differently depending on the type of<br />

command and what it needs to communicate. This section describes the response for the<br />

creation, action, and view command types.<br />

NOTE Often it is useful to know the host, port, and user that a command used to<br />

connect to the <strong>MKS</strong> <strong>Integrity</strong> Server. The <strong>MKS</strong> API has functions and methods to<br />

return this information. For more information, see the <strong>MKS</strong> Java API documentation<br />

or the <strong>MKS</strong> ANSI C API documentation.<br />

To find any errors that occurred as part of the response for a command specified for the C<br />

API, you need to search for them explicitly. For more information, see “C API Application<br />

Errors” on page 33.<br />

Creation Commands<br />

Creation commands create something new, for example, an <strong>MKS</strong> <strong>Integrity</strong> item. The command<br />

names usually start with the word “create”. The response for a creation command<br />

communicates the item that was created or what errors prevented the item from being<br />

created.<br />

If the command ran successfully, the result contains information about what was created. The<br />

result message is the same text shown by the CLI, for example, “Created issue 123”.<br />

If you want to continue working with the created item, you do not need this message; you<br />

only need the ID of what was created. The following examples show how to retrieve the item<br />

ID from the result.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!