Operational API samples
Overview
The Operational API (OAPI) samples cover the most common tasks such as running projects, running automations, and getting site logs.
The OAPI samples are OAPI client programs written in Java that demonstrate how to perform common tasks using the OAPI. There are five samples; each is a complete standalone program.
The samples are primarily intended as source code that help you understand how to use the OAPI from Java.
To keep the samples small and easily readable, various parameters such as the username and password, the target host, and the project path are hard-coded as static fields. The static fields are located at the top of the test class definitions to make them easy to find and modify.
Requirements
To read the source code, get the samples JAR file: oapi-samples-1.X.jar.
The source code for each sample is at the following locations in the JAR file:
net/redpoint/integration/oapi/samples/SimplePing.java
net/redpoint/integration/oapi/samples/LoginLogout.java
net/redpoint/integration/oapi/samples/RunProject.java
net/redpoint/integration/oapi/samples/RunAutomation.java
net/redpoint/integration/oapi/samples/GetSiteLogs.java
Sample Descriptions
SimplePing
This is the most simple OAPI client. It demonstrates how to build a proxy object to an instance of the OAPI, invoke the ping operation, and print the result.
To run, enter command:
> java -cp oapi-samples-1.X.jar net.redpoint.integration.oapi.samples.SimplePing
LoginLogout
This sample is more complete; it demonstrates how to:
initialize
Jersey
to log HTTP request and responsesregister the
JacksonFeature
, which converts JSON objects to and from Java objectslogin to start a new session and print out the
sessionId
logout and print result
To run, enter command:
> java -cp oapi-samples-1.X.jar net.redpoint.integration.oapi.samples.LoginLogout
RunProject
This sample demonstrates how to:
login
load a project
start running a project
check the status of the project until it has completed
get the message count for the project
get "count" messages and print them
logout
To run, enter command:
> java -cp oapi-samples-1.X.jar net.redpoint.integration.oapi.samples.RunProject
RunAutomation
This sample demonstrates how to:
login
load an automation
start running an automation
check the status of the automation until it has completed
get the message count for the automation
get "count" messages and print them
logout
To run, enter command:
> java -cp oapi-samples-1.X.jar net.redpoint.integration.oapi.samples.RunAutomation
GetSiteLogs
This sample demonstrates how to:
login
get the log count
get all logs and list their information
get the log for log ID = 1
get the log details for logs 1 - 8
find a log with a detail counts that is > 0 and get its messages and print them
logout
To run, enter command:
> java -cp oapi-samples-1.X.jar net.redpoint.integration.oapi.samples.GetSiteLogs