Error when importing report via REST

Hello,

Running jasperserver 8.02

We can import/export reports without any issue from the Jasper UI, but when trying to publish/import via the REST API we are receiving the error message "import.decode.failed" when checking the status of the job.

We have tried doing the export from the UI with both options on the "Import-Export Key" fields ("Server Key" and "Legacy Key") during the export to no avail. Same message about decoding failing.

There are no custom keys created at this point, so I am at a bit of a loss as to what to use for the REST calls to publish correctly. I've looked at the Jasper docs, and they don't include any example references related to Keys.  Only a generic HTML form example at the bottom of this import/export page...no reference to using encoding.

I'm sure it is something simple that we're missing, so any help is greatly appreciated.

tom.beckman's picture
Joined: Feb 28 2014 - 7:39pm
Last seen: 4 months 2 weeks ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

arai_4 - 4 months 3 weeks ago

Thank you for that info...I was able to get the reports exported from one server into another using the /buildomatic/ scripts with that keyalias, but I am still unable to perform the import using the REST api.

I created the same headers/payload that you gave in the example, but every time I check the status of the import process, I get the "import.decode.failed" message.

any suggestions?

tom.beckman - 4 months 2 weeks ago

1 Answer:

You should be using the keyalias=deprecatedImportExportEncSecret argument in your RestAPI import/export to exchange resources from different instances with different keystore using RestAPI. See documentation here 

This is an example : 

curl --location --request POST '<a href="http://localhost:8080/jasperserver-pro/rest_v2/import?keyalias=deprecatedImportExportEncSecret" rel="noopener noreferrer" target="_blank">http://localhost:8080/jasperserver/rest_v2/import?keyalias=deprecatedImportExportEncSecret</a>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/zip' \
--header 'Authorization: Basic ckljsqdlkjlkqsjd2lkqjscg==' \
--header 'Cookie: userLocale=en_US; JSESSIONID=10CD33082811F8778C8533F00B0FF405' \
--form 'file=@"/C:/export.zip"'

bdraifi's picture
1001
Joined: Mar 17 2020 - 11:53am
Last seen: 1 week 7 hours ago
Feedback
randomness