Digital Exchange

last person joined: 10 hours ago 

This community is a place to discuss Blue Prism DX assets and development.

Expand all | Collapse all

Send .xlsx File using POST API

Jump to Best Answer
  • 1.  Send .xlsx File using POST API

    Posted 07-19-2021 06:30
    I have a requirement of sending .xlsx file using POST API.

    I guess Ideal way of doing this is to use Single File option in WEB API configuration and passing Binary file from process.

    But unfortunately the WEB API definition does not support the Binary File, even when used Binary File option from POSTMAN , it throws server error.

    There are two options available it seems

    1 ) Form-data : When I use this option in POSTMAN, it works fine but not sure how to use this option in Blueprism as Blueprism supports only below option 

    none
    Template
    Single File
    Multiple File
    Custome Code

    2) Custom Code: Can someone guide how to use this option and code example of Posting xlsx file using content type multipart/form-data

    ------------------------------
    Kirtish Trivedi
    ------------------------------


  • 2.  RE: Send .xlsx File using POST API
    Best Answer

    Posted 07-19-2021 08:40
    Hi Kirtish,

    The latest Utility - HTTP on Digital Exchange has action for Multipart request. Have you already considered that for your solutioning?


    ------------------------------
    Shashank Kumar
    DX Integrations Partner Consultant
    Blue Prism
    Singapore
    +6581326707
    ------------------------------



  • 3.  RE: Send .xlsx File using POST API

    Posted 07-19-2021 14:28
    Hi @Shashank Kumar,

    I have tried using ​Utility - HTTP and action HTTP Request Multipart but still facing Internal server error 500

    I have passed below parameter

    Address URL : [URL]
    UserName:[UserName]
    Password:[Password]
    forcePreAuth: True

    Header parameter Accepts Collection type Hence Passing below

    Autharization : [Basic XXX]

    FileData accepts collection type hence passing below

    FileName: ""
    FieldName:""
    ContentType:""
    FilePath : "C:\..\abc.xlsx"

    After running I am getting 500 Internal server error

    When I checked with API team they say they are not getting file details in the request

    Also they are getting boundry as below :

    multipart/form-data; boundary=boundaryboundary

    Is there anything I am doing wrong ?


    ------------------------------
    Kirtish Trivedi
    ------------------------------



  • 4.  RE: Send .xlsx File using POST API

    Posted 07-19-2021 14:42
    Hi Kirtish,

    If forcePreAuth is set to True then the Authorization Header will be set by the utility. So can you try again without passing any Header parameter.

    ------------------------------
    Shashank Kumar
    DX Integrations Partner Consultant
    Blue Prism
    Singapore
    +6581326707
    ------------------------------



  • 5.  RE: Send .xlsx File using POST API

    Posted 07-19-2021 14:56
    Hi @Shashank Kumar,

    I tried that, I deleted everything from HEADER Collection and made it Empty and ran . Got the same error. and Header collection remains empty after the run. Is there anything else which can be of concern ?​

    ------------------------------
    Kirtish Trivedi
    ------------------------------



  • 6.  RE: Send .xlsx File using POST API

    Posted 07-19-2021 15:19
    Hi Kirtish,

    One other thing that I can think of is the FieldName. Currently you have set it to blank in HTTP utility. Did you set any value for "Key" under form-data in POSTMAN for this? 


    ------------------------------
    Shashank Kumar
    DX Integrations Partner Consultant
    Blue Prism
    Singapore
    +6581326707
    ------------------------------



  • 7.  RE: Send .xlsx File using POST API

    Posted 07-19-2021 15:55
    Hi @Shashank Kumar,

    Under Form-data in Postman, I have used one Key and in value I have attached .xlsx file,

    As mentioned by you I used the same key in FieldName as well but the same error exists : 500: internal server error​

    ------------------------------
    Kirtish Trivedi
    ------------------------------



  • 8.  RE: Send .xlsx File using POST API

    Posted 07-20-2021 07:08
    Hi @Shashank Kumar.

    Issue is Resolved now. Thank you for your guidance. ​Along with the FieldName ,I added other values as well and it worked.

    When I checked "Code" in PostMan I noticed there were few more parameters were being sent with request for uploading excel hence I mapped them in FileData Collection of Multipart Action as below

    FileName- abc.xlsx
    FieldName-FileName variable
    Content-Type-application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    File path-Full file path


    ------------------------------
    Kirtish Trivedi
    ------------------------------



  • 9.  RE: Send .xlsx File using POST API

    Posted 07-28-2021 05:28
    Update : Please ignore below. Issue is resolved by setting up request.timout field in code

    Hi @Shashank Kumar,
    Thanks for your help with this .

    I have used HTTP Utility​ and It was working fine until yesterday but now it is throwing below error

    Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object.

    I have passed below/attached parameter

    Update : This seems to be timeout error issue. It works with Smaller size. Is there any way to set timeout ?
    It takes around 2 min 10 seconds before it throws an error

    Also when I remove Try and Catch block , it throws below error

    Could not execute code stage because exception thrown by code stage: The operation has timed out

    ​Could you please assist with the possible cause and if it due to timeout, can you please let me know how to increase timeout ?
    Note : Working fine through POSTMAN
    ------------------------------
    Kirtish Trivedi
    ------------------------------



  • 10.  RE: Send .xlsx File using POST API

    Posted 07-28-2021 10:28
    Try out the suggestion from Bruce to increase the timeout value. Let us know if it works.

    ------------------------------
    Shashank Kumar
    DX Integrations Partner Consultant
    Blue Prism
    Singapore
    +6581326707
    ------------------------------



Welcome to the Blue Prism Digital Exchange Community!

The Blue Prism Digital Exchange is a "shop window" for new and emerging technologies—a platform that puts powerful RPA and AI capabilities into the hands of business leaders. Users can find and apply pre-built AI capabilities, in the form of downloadable integrations and Visual Business Objects (VBOs), to automated processes. These assets connect and integrate Digital Workers, existing systems and processes to Blue Prism's technology partners, creating a solid foundation of AI-enabled Intelligent Automation that's scalable and sustainable.

Blue Prism Digital ExchangeDX Asset IdeasContact DX Support

FAQs

The Blue Prism Digital Exchange (DX) is an online marketplace where businesses can instantly access, apply and share pre-built AI, cognitive and advanced RPA technologies from best-in-class providers. These assets easily connect to existing digital workers, systems and processes to enhance automation capabilities.
The Digital Exchange is free to all users. Most of the content on the DX is free to download but there are some submissions that do have a cost associated. The submissions with a cost are advertised on the asset card and profile. No unwanted costs will be applied to any users.
You can visit and browse the Digital Exchange here. If you would like to consume or download any material it is necessary to create an account on the Blue Prism Portal first.
Everyone can access the Digital Exchange and consume the assets on it. If you would like to contribute to the marketplace it is necessary that you create an account and sign up as a partner.