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 create a get api to download a file from a SFTP server file path

    Posted Tue January 24, 2023 07:03 AM
    Hi Guys,

    Could anyone guide me on how to download a file from a seperate sftp server to the response body using API Connect

    ------------------------------
    Suraj Sakpal
    ------------------------------


  • 2.  RE: How to create a get api to download a file from a SFTP server file path

    Posted Wed January 25, 2023 10:31 AM
    Hi Suraj, 

    A member of our team said that "a simple GS policy will do the job. you can wrap it as user defined policy" - here is a link to the KC for it. 

    let me know if this helps - I will try to get a more detailed response as soon as I can.

    Best,

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



  • 3.  RE: How to create a get api to download a file from a SFTP server file path

    Posted Fri January 27, 2023 08:48 AM

    Hi Suraj,

    To access your sftp server, you'll need to write a xsl stylesheet that uses a dp:url-open  extension function using a sftp url.  Here's a link to the DataPower knowledge center for an example.  https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=open-url-sftp.  You can do this in API Connect as an xslt policy.  I understand many like GatewayScript policies instead of xslt as stylesheet coding is becoming a lost art, but unfortunately, DataPower GatewayScript only supports http(s), (dp)mq, and  graphql protocols.  There are more protocols supported by the xslt extension function.  If you need this capability in a more general sense than just this one API, then yes you could create a UDP where the UDP property could be the sftp server url, or perhaps broken down further to sftp server, username, password, path where your xslt in the UDP would build the url from the UDP properties.

    Best Regards,

    Steve



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



  • 4.  RE: How to create a get api to download a file from a SFTP server file path

    Posted Mon January 30, 2023 09:11 AM
    Edited by john maclain wright Mon January 30, 2023 01:25 PM
    Hi Suraj,

    Thanks for raising the issue, actually i have also developed an app and want to access my site data with limited API access using FTP server, implementing the same procedure mentioned below, please let me know if you have already tried this and works for you,


    ------------------------------
    John Maclain
    ------------------------------


    ------------------------------
    john maclain wright
    ------------------------------