Robotic Process Automation (RPA)

 View Only
Expand all | Collapse all

How to create a multipart form data http request containing a json and a file in the request body?

  • 1.  How to create a multipart form data http request containing a json and a file in the request body?

    Posted Fri August 26, 2022 08:55 AM

    I'm trying to upload files to the box but I could only make it work using curl, and with curl when I try to upload large files (over 30 MB) it sometimes hangs the script execution (the script does not break but the command does not timeout).
    Is there any way to make the same request using only native IBM RPA commands?

    Below is the link to the Box upload file documentation and an example of the request using cURL:

    API Reference

    curl -i -X POST "https://upload.box.com/api/2.0/files/content" \ -H "Authorization: Bearer <ACCESS_TOKEN>" \ -H "Content-Type: multipart/form-data" \ -F attributes='{"name":"Contract.pdf", "parent":{"id":"11446498"}}' \ -F file=@<FILE_NAME>



    ------------------------------
    Pedro Botolli Santos
    ------------------------------


  • 2.  RE: How to create a multipart form data http request containing a json and a file in the request body?

    Posted Wed August 31, 2022 09:30 AM
    What have you tried to do? Can you share a simple script?

    ------------------------------
    Joba Diniz
    Product Manager
    IBM
    ------------------------------



  • 3.  RE: How to create a multipart form data http request containing a json and a file in the request body?

    Posted Thu September 01, 2022 03:15 PM
      |   view attached

    In the attached file, there is the script with examples of what did to upload files to Box.

    To generate access credentials to Box API it is necessary to follow this guide.



    ------------------------------
    Pedro Botolli Santos
    ------------------------------

    Attachment(s)

    zip
    boxUpload.zip   15 KB 1 version