Mahesh Ankaraju Posted June 7 Share Posted June 7 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 More sharing options...
Peter McKinnis Posted June 7 Share Posted June 7 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 1 Link to comment Share on other sites More sharing options...
Mahesh Ankaraju Posted June 12 Author Share Posted June 12 Hi Peter, Thanks for the information, I am trying to review the same. Do you have an example of the same to make it technically easy for me to pick things up. Regards Mahesh Ankaraju Link to comment Share on other sites More sharing options...
Mahesh Ankaraju Posted June 28 Author Share Posted June 28 Hi Peter Any help on finding some sample code for the same., documentation dint help much to try doing what is spoke. Regards Mahesh Ankaraju Link to comment Share on other sites More sharing options...
Peter McKinnis Posted July 1 Share Posted July 1 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now