Can Bridge use Smartsheet APIs with HTTP Call Utility Function?

Jake_Dowson
Jake_Dowson ✭✭
edited 07/04/23 in Add Ons and Integrations

Hi,

I'm trying to manage some automated attachments of files to rows in Smartsheet. I've gotten to the point of retrieving the file from its source and am ready to upload it to a Smartsheet row via API. I also have this API request working in Postman.

Where I am struggling is when I try to implement this API request in Bridge using the HTTP Call function. I have replicated the structure of the call in Bridge from what I have working in Postman but I find that Bridge just (I assume) times out on the API call.

When looking at the run log all I get for the Smartsheet API call is "Stopped" after a 5-10 minute wait.

So, my questions are as follows:

  1. Has anyone got a Smartsheet API call working from Bridge using the HTTP Call?
  2. If you have, have you got the Attachments endpoints working to add a file attachment to something in Smartsheet?
  3. Is there any debugging or trouble shooting that I'm missing? I'm not aware of a way to see the logs for incoming requests from a Smartsheet point of view and the Run log in Bridge gives very, very little information.

Example of my request config:

URL: https://api.smartsheet.com/2.0/sheets/[StaticSheetID]/rows/[DynamicRowID]/attachments

Method: POST

Headers:

  1. Content-Disposition: attachment;filename="{{states.startstate.smartsheet.get_row.row.cells.FileName.value}}"
  2. Content-Length: [File Length]
  3. Content-Type: application/pdf
  4. Host: api.smartsheet.com

Body: Binary return from a previous HTTP Call that returns a file

I have also tried this with and without the Authorization header. Postman obviously needs the Authorization header with an API key. I have other HTTP Calls that seem to use connector Auth in Bridge so I have tried this call with and without this header with no difference in result.

Answers

  • Hey @Jake_Dowson

    Bridge doesn’t yet support the movement of attachments, but it does support hosted urls for attachments that don’t require the workflow to handle the actual file.

    Postman handles the body of the file differently than Bridge's HTTP Call. Where as Postman will knowingly convert the file to binary data and submit it as the payload, Bridge cannot currently take a file path and turn it into Binary within the workflow itself.

    You may be able to do this through a custom module build that the Consulting team may be able to create for you.

    To answer your questions:

    1. Yes, Bridge is able to work with the Smartsheet API using the HTTP call and I have successfully used this before.
    2. However since Bridge is unable to handle files, the error you're experiencing is expected. So no, the Attachment endpoint won't be able to POST to your sheet via Bridge.
    3. The Run Log error message is what I would look at as well - Smartsheet Support should be able to help dig into the error in the back-end and provide more context if you receive vague errors.


    Please feel free to submit your feature request to the Product team by creating an Idea Post in the Smartsheet Product Feedback and Ideas topic here in the Community. This will allow other users to vote on your Bridge enhancement idea!

    Cheers,

    Genevieve

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

  • Hi Genevieve,

    Thanks for the update.

    Just to confirm then, even if the fille is already in a binary state when returned from the first API call and is directly referenced from the first API call to the second API body Bridge simply won't handle this as it doesn't have the ability to handle files of any type?

    Is there any way to confirm if there are future plans for Bridge to support this type of functionality?

    Thanks

    Jake

  • Hey @Jake_Dowson

    In all honesty I'm not quite sure about the exact specifics on what may be possible since it's not an out-of-the-box capability. There may be a way to leverage Bridge to pass files; I believe the Consulting team has built a custom solution for this before, likely with the binary data as you have generated.

    It would depend on the source and destination... if the destination can accept the binary in its current form it could likely work through Bridge. Smartsheet Attachment API requires the fileSize to be specified, so if you know the size then it may be possible, or you could maybe use the JavaScript modules to determine size.

    Submitting your Idea to the Product Team is the best way to ensure your feedback is considered for future development, so thank you for creating the Idea post! 🙂

    Cheers,

    Genevieve

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

  • Final Update now I have a working solution, for anyone that might find this post.

    I ended up turning to Power Automate in order to solve this issue. My Power Automate uses the HTTP request trigger and takes the following parameters:

    • SheetID
    • RowID
    • FileName

    Power Automate then gets the file content and meta data from SharePoint (know static location) for the FileName. This is then sent back to SmartSheet API "Attach to a row".

    I'm then calling this Power Automate flow from Bridge using a HTTP Call. Something interesting I found there was that if I "Composed Text" the JSON body for the HTTP Call it didn't work. I had to enter the static JSON into the Body field of the HTTP Call and reference dynamic references from there.

    I wonder whether this points to the reason why a straight call from Bridge doesn't work when the body of the HTTP Call is just a reference to a previous action.

    Hopefully Smartsheet with consider file management in Bridge and implement some more of their own APIs as native actions in Bridge.

    Thanks

    Jake

  • Darren Mullen
    Darren Mullen ✭✭✭✭✭✭

    @Genevieve P. Hi!

    I came across this post and wanted to see if there are any updates in bridge around file handling? I'd like to be able to get a file from a row on Smartsheet and then re-upload the file through the Smartsheet API.

    I thought I could try doing this with the Javascript Module, but don't think it supports the methods needed like fetch()?

    But I'm only a Javascript amateur, so maybe I'm missing a way to do this.

  • Hi @Darren Mullen!

    No updates at this time, but there is now an Idea post to vote on and add your feedback: Enable File Handling in Bridge

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

  • Darren Mullen
    Darren Mullen ✭✭✭✭✭✭

    @Genevieve P. Thanks for the link to the feature request, I voted it up and commented ;)