API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Tue February 14, 2023 11:24 PM

    Hi

    We are unable to upload a file in API Connect using restAPI.

    We are using the below for the yaml file.

    Method = Put

    Protocol = HTTP / HTTPS

    Body - Multi-Part

    Type - File

    In invoke we have given the target path as https://<host>:<port>/nlpmDev/Transport/$(request.body.pdfFile)

    Please help or suggest on this.

    Thanks



    ------------------------------
    Nrusingha Sahoo
    ------------------------------


  • 2.  RE: How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Sun March 12, 2023 06:33 PM

    Hi Nrusingha, 

    I apologize that your question has not been answered. I have escalated it to the team and to our integration specialists. we could file a support ticket, if you have not already.

    Again, apologies for the inconvenience.  



    ------------------------------
    Gabriel Marte Blanco
    Austin TX
    ------------------------------



  • 3.  RE: How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Mon March 13, 2023 09:09 AM

    Hi Nrusingha,

    A multipart form  that you're posting would come with a multi-part content-type that would specify a boundary, and then the actual payload would look something like

    --boundary
    Content-Disposition header of the root part
    Content-Type header of the root part
    perhaps other headers for the root part
    
    data
    
    --boundary
    Content-Disposition header of the attachment part, which could include a filename="your pdf file name"
    Content-Type header of the attachment part
    perhaps other headers for the attachment part
    perhaps other headers of the attachment
    
    data
    
    --boundary--

    What exactly are you attempting to do?  If you want to simply forward the multipart form to the backend, you must ensure that there is not a parse policy that precedes the invoke policy.  Are you wanting to extract the actual pdf attachment and post just that?  If so, your URI of the invoke's target-url  having /$(request.body.pdfFile) does not look right.   Are you expecting that to be the filename?  If so then you'll need to be extracting the filename from the Content-Disposition header of the attachment and using that in your target-url.

    Please provide some more detail on exactly what your requirement is.

    Best Regards,
    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 4.  RE: How to upload a pdf file in IBM API Connect v10 using rest API

    Posted Thu March 16, 2023 11:39 PM

    Hi Steve,

    Thanks for your response.

    Can you please guide how can we fetch the data dynamically from the requested .pdf file and do encrypt for specific values?

    Thanks

    Nrusingha Sahoo



    ------------------------------
    Nrusingha Sahoo
    ------------------------------