EUM API: help needed to upload a new script

I am trying to use the EUM_API in BSM 9.25 to upload a new script into the script repository. I am using Chrome and the POSTMAN app to make a POST, so far I have:

General:
POST 
/topaz/eumopenapi/sr/script/upload?script_name=test1&parent_folder_id=11

Request Headers:
Authorization: Basic <my base64 encoding>
Content-Type: multipart/form-data

Request Payload:
Content-Disposition: form-data; name="script_name"; filename="Fictitious Mineral Buying App.zip" Content-Type: application/x-zip-compressed

However, I get back a HTTP response code of 415 (Unsupported Media Type). What mime type should I be using in the request?

Parents Reply Children
  • Hi ketan_mistry,

    After testing for several hours and not getting further at all, I finally found a service request (covering a totally different issue) but it shows what needs to be done,
    Content-Type has to be of type "application/octet-stream", then it works
    (tested successfully on both BSM 9.25 IP1 and BSM 9.26 IP1 with Mozilla Firefox and Poster Add-On)

    Greetings
    Siggi

  • Getting a 500 (internal error), here is how it looks in Google's Postman:

    Is there anything different to what you are doing? I am successfully using the same Basic authentication header to create (POST) script folders under the root parent, so I don't believe its security. Also the parent_folder_id has been changed with no luck. I can upload the same script by hand via the UI.

  • Getting a 500 (internal error), here is how it looks in Google's Postman:

    Is there anything different to what you are doing? I am successfully using the same Basic authentication header to create (POST) script folders under the root parent, so I don't believe its security. Also the parent_folder_id has been changed with no luck. I can upload the same script by hand via the UI.

  • Getting a 500 (internal error), here is how it looks in Google's Postman:

    Is there anything different to what you are doing? I am successfully using the same Basic authentication header to create (POST) script folders under the root parent, so I don't believe its security. Also the parent_folder_id has been changed with no luck. I can upload the same script by hand via the UI.

  • Verified Answer

    Hi ketan_mistry,

    it works fine with Mozilla and the Poster Add-On.
    When I use Chrome and the Postman Add-On (and first managed to find my way around in PostMan), I also get the error you get

    Fehler beim Fertigstellen des erforderlichen Vorgangs aufgrund eines internen Serverfehlers.
    (german for "Failed to complete the requested operatiion due to a server internal error."

    I found this entry in the log (<GW>>\log\jboss-as.log, same in <GW>>\log\ma-app.log)

    2016-05-11 14:23:02,441 [ajp-/127.0.0.1:8009-5] (SrScriptResource.java:113) ERROR - createScript- failed to create new script in CRS.
    com.mercury.am.eum.shared.management.exceptions.EumErrorException: Failed to create script. You selected an incorrect type of script. Select a different script.

    ###-------------SR failed exceptions ---------####
    server.FileSetTypeAutoDetector.autodetect.ERROR=You selected an incorrect type of script. Select a different script.

    When you add a script manually via the GUI, you need to specify a type, usually it's "AUTO-DETECT", but you might also specify for example "VUGEN".

    I had a look at the source code (SrScriptResource.java)

    @PatH("eumopenapi/sr/script")

    @POST
    @PatH("/upload")
    @Consumes(MediaType.APPLICATION_OCTET_STREAM)
    @Produces(MediaType.APPLICATION_XML)
    public SrScriptBean uploadScript( @context HttpServletRequest httpServletRequest,
    @QueryParam(SCRIPT_NAME_PARAM) String scriptName,
    @QueryParam(PARENT_FOLDER_ID_PARAM) String parentFolderId,
    InputStream is) throws WebApplicationException {

    Here I found at least what Content-Type has to be used for the individual API calls (I guess I'll write a KCS document for it).
    but this doesn't help ...

    We fail here:

    private void setScriptType(SRScriptModifiable requestScript, SRScriptType scriptType) throws EumErrorException {
    if (scriptType == null) {
    throw new EumErrorException(getType(), EumOperationsConstans.TYPE_NOT_FOUND);

    for whatever reason, it seems Chrome with PostMan does something different from Mizilla Firefox with Poster.
    Ah, here we go!

    It simply cannot open the script file, and thus cannot identify the script type.

    After changing Body -> form-data to Body -> binary and then specifying the script file name,
    all works like a charm:



    Greetings
    Siggi