Jump to content

Automating the promotion/ migration operations between spotfire environments.


Recommended Posts

Hi All,

I read below statement in whats new in spotire 14.0.

"The Library REST API simplifies promotion and migration operations between Spotfire environments and facilitates automation with CI/CD pipelines." 

Is there a way to build something upon spotfire to give a UI to users (admin to a particular project) allowing him to do promotion to higher environments from DEV.

Link to comment
Share on other sites

Mahesh,

Yes, one could use the Library REST API v2 to download and upload between environments as a CI/CD process.   I would recommend calling the Get information about the Library endpoint first as the return LibraryInfo object contains objects UploadInfo and DownloadInfo that list which Library Item Types are supported for upload and download.

One should be able to build a UI either within Spotfire or using some other method.  A tool on the command line might be a good place to start since one can figure out all the information required and any other services that may be needed.  

Regards,

Peter

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Mahesh,

I am not sure how detailed an example you need.  As documented, the first step is to register an api client.  Example:

config register-api-client --name="LibaryRESTAPIClient" -Sapi.library.write -Sapi.library.read

This will return a Client ID and Client Secret which you can use in any tool that supports REST API testing.  You can also use it in the Swagger UI that Spotfire provides: 

http[s]://<host>[:<port>]/spotfire/api/swagger-ui.html?urls.primaryName=library-v2

Spotfire provides an Open API Specification (OAS) JSON endpoint which can be used to create client stubs.  You can find tools on the web to convert the OAS into client stubs for various programming languages.  The OAS JSON is available at this URL:

http[s]://<host>[:<port>]/spotfire/api/v2/api-docs?group=library-v2

As I mentioned previously, using the "info" service path will tell you what is supported for the upload and download of Library items.  This endpoint can be run on the Swagger UI.

After getting the client id and client secret, one calls the token endpoint to get the access token.  Here is an example using the command line curl program:

curl -k --data "grant_type=client_credentials&scope=api.library.write api.library.read" -u <YOUR_CLIENT_ID>:<YOUR_CLIENT_SECRET> -H 'Accept:application/json' http[s]://<host>[:<port>]/spotfire/oauth2/token

After one gets the token, the token can be passed to the various service paths.  This example show curl calling the "info" service path with the token in a TOKEN environment variable:

curl -v -H "Authorization: Bearer $TOKEN" --url http[s]://<host>[:<port>]/spotfire/api/rest/library/v2/info

Hopefully, this is enough information to get you started.  From here, you can call other service paths to get other information, e.g. search the library, update items in the library, download and upload, etc.

Regards,

Peter

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...