apokrifit Posted July 25 Share Posted July 25 Hello everyone! How can I upload a zip file exported from spotfire (version: 14.0.2) using restAPI? The content of the zip file is a directory that contains other directories that contain analyzes and information links. The authentication is successful, I receive the token and, in the case of a DXP file, I successfully upload it using the API. But if I try the export .zip format, I don't know what type to refer to when creating the upload job. I found these types but it doesn't work with any of them. https://docs.tibco.com/pub/spotfire_server/14.0.2/doc/html/TIB_sfire_server_tsas_admin_help/server/topics/spotfire_item_types.html If I stay with the dxp type (I get "unsupported item type" for the spotfire.folder type), I get the following error for "add data to an upload job": {"error":{"code":"unsupported_mediatype","description":"The media type of the request payload is unsupported"}} The two curl functions I'm trying to use: create_job() { BEARER_TOKEN=$1 LOCATION_ID="dfdfd49c-842c-42f7-9446-70b1df23a909" URL="$SPOTFIRE_SERVER_URL/spotfire/api/rest/library/v2/upload" AUTH_HEADER="Authorization: Bearer $BEARER_TOKEN" curl -X POST "$URL" \ -k \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "$AUTH_HEADER" \ -d '{ "item": { "title": "TestUpload", "description": "test", "type": "spotfire.folder", "parentId": "'"$LOCATION_ID"'" }, "overwriteIfExists": true }' } upload_data() { BEARER_TOKEN=$1 JOB_ID=$2 FILE_PATH="./analysis.part0.zip" #FILE_PATH="./priv.dxp" CHUNK='1' FINISH='false' URL="$SPOTFIRE_SERVER_URL/spotfire/api/rest/library/v2/upload/$JOB_ID?chunk=$CHUNK&finish=$FINISH" AUTH_HEADER="Authorization: Bearer $BEARER_TOKEN" curl -X POST "$URL" \ -k -v \ -H "accept: application/json" \ -H "$AUTH_HEADER" \ -H "Content-Type: application/octet-stream" \ --data-binary "@$FILE_PATH" } Could you help me if this can be done with an export file? BR Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted July 26 Share Posted July 26 Hi apokrifit, Just to be clear, you want to import a zip file into the Spotfire library, using the API, right? Does the solution have to be a curl command? Or could you also use command line or iron python (or in the latest version, Action mods)? In the case of using APIv2, you can find more information in this document (Library upload can be found in section 5.1): https://docs.tibco.com/pub/spotfire_server/latest/doc/api/TIB_sfire_server_REST_API_Reference/library-v2.html Kind regards, David Link to comment Share on other sites More sharing options...
apokrifit Posted July 26 Author Share Posted July 26 (edited) We want to import the exported analysis with APIv2, without configtool (we want to replace this with APIv2 in the import process). I couldn't find an answer in the description what type of complex (libraries, dxp's, infolinks) exported zip could be used to accept it and not have the add-data-to-job response: "payload is unsupported" Edited July 26 by apokrifit Link to comment Share on other sites More sharing options...
Solution Olivier Keugue Tadaa Posted July 26 Solution Share Posted July 26 Hi Apokrifit, " This API is used to upload & browse files of the Spotfire library. The upload of a file is made through a number of calls." Basically what is said here is that you can use it to upload a library artifact of any of these supported types (the list is the one you mentioned here https://docs.tibco.com/pub/spotfire_server/14.0.2/doc/html/TIB_sfire_server_tsas_admin_help/server/topics/spotfire_item_types.html) This is unfortunately not meant to replace the library import/export tool that can be done either by the command line (you need the config tool) or the Analysts user interface Library Administration. indeed the zip file is an archive that can only be interpreted by the import-export framework. To achieve what you are doing, I'd encourage you to install the config tool (https://docs.tibco.com/pub/spotfire_server/14.4.0/doc/html/TIB_sfire_server_tsas_admin_help/server/topics/running_the_configuration_tool_on_a_local_computer.html) and run a command similar to this one config import-library-content --file-path="..\application-data\library\<the zip file name>" --conflict-resolution-mode=KEEP_NEW --user=melt --include-access-rights=true --item-type=all_items --library-path=/ I hope this helps, 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