REST API to Execute TIBCO Spotfire® Automation Services Jobs

Last updated:
1:15am May 09, 2019

Back to TIBCO Spotfire® Web Services API Overview page

Introduction

Automation Services jobs can be triggered from an external application using a REST API (available from version 7.13). A job can either be stored in the Spotfire library or passed as an argument. The API uses an OAuth2 based authentication/authorization mechanism.

The API consists of the following calls:

  • Start an Automation Services job from a library file
  • Start an Automation Services job from XML
  • Get status of an Automation Services job
  • Abort an ongoing Automation Services job

Instructions

Register API client

Before using the API you need to register an API client to get client credentials. This is done with the register -api -client command with scope set to api.rest.automation-services-job.execute (see here for more details).

  • C:\tibco\tss\7.13\tomcat\bin>config.bat register-api-client -Sapi.rest.automation-services-job.execute -n [API user name]

Note: In the default server configuration, the public web services (REST and SOAP) are enabled. If they are not enabled on your server instance, they can be enabled by using the config-web-service-api command (see here for more details).

Using the API

Every API call is authenticated with an access token which is retrieved by passing in the client credentials to the token endpoint. If the access token has timed out, you'll need to retrieve a new one.

A typical call sequence for executing an Automation Services job looks like this:

  1. POST http[s]://<host>[:<port>]/spotfire/oauth2/token
  2. POST http[s]://<host>[:<port>]/spotfire/api/rest/as/job/start-content (job passed as XML) or 
    POST http[s]://<host>[:<port>]/spotfire/api/rest/as/job/start-library (job stored in the Library)
  3. GET http[s]://<host>[:<port>]/spotfire/api/rest/as/job/status

For detailed instructions on how to obtain an access token, call the API endpoint URLs and set various parameters, see:

API documentation is also available in the OpenAPI (Swagger) format at:

  • http[s]://<host>[:<port>]/spotfire/api/v2/api-docs.

Examples

Swagger UI

The Spotfire Server provides the Swagger UI, a test tool that allows you to visualize and interact with the API. The Swagger UI is available at: 

  • http[s]://<host>[:<port>]/spotfire/api/swagger-ui.html

C#

Spotfire SDK includes an example of a standalone C# program that uses the Automation Services REST API and also the SOAP based Library Service. 

  • Instructions on how to download the SDK can be found here.
  • The example is located in the SDK\Examples\Integration\SpotfireDeveloper.ServerApiExample folder.

The example program takes care of all the implementation details related to retrieving the access token and create the HTTP request for each API call.