Forum Discussion

craig_williams's avatar
craig_williams
New Contributor
7 years ago

REST POST a file to box.com

Hi, I’m trying to do a multi-part form REST Post to box.com upload API which requires a file and an attributes part. We’re getting an error indicating that the parent parameter can’t be found. Parent is essentially the folder id in Box. The box API says the call would be sent like so:

curl https://upload.box.com/api/2.0/files/content
-H “Authorization: Bearer ACCESS_TOKEN” -X POST
-F attributes=‘{“name”:“tigers.jpeg”, “parent”:{“id”:“11446498”}}’
-F file=@myfile.jpg

Here’s the sample pipeline Box REST POST_2018_08_29.slp (8.6 KB)

In this iteration I’m creating the attributes as an expression and passing it into the HTTP entity element in the REST POST Snap. I’m not sure how else to pass these attributes data elements to the REST POST call. I feel like I’ve tried everything but box.com doesn’t seem to see the parent attribute which is necessary for the call to succeed. Admittedly, I’m a bit new to using the REST snaps, but hoping someone could throw out some ideas to try. Thank you!

Craig

5 Replies

  • tgarcia's avatar
    tgarcia
    New Contributor II

    I’ve been experiencing the same issue as Craig here. I tried replicating the examples from the REST POST documentation on uploading a file, but I don’t seem to be able to pass the ‘parent’ parameter to the API.

    • ptaylor's avatar
      ptaylor
      Employee

      Have you tried using the Box snaps instead of the REST snaps?

      • craig_williams's avatar
        craig_williams
        New Contributor

        We did use the box.com snap in a trial and successfully posted a file, however, given a limited budget, was hoping to not have to purchase the box snappack if there wasn’t a need and the REST API could do the trick.

  • tgarcia's avatar
    tgarcia
    New Contributor II

    Same here. Our organization doesn’t have the Box Snap Pack, and I was hoping that I could get generic REST POST functionality out of the REST snap pack.

  • Lidiya_Thomas's avatar
    Lidiya_Thomas
    New Contributor II

    Hi @craig.williams were you able to do so?

    Even I am getting the same error.

    I tried with Box write snap too but I am not able to still write to Box, the file that gets written is unreadable. I was able to write to Box using rest call through Postman.

    Please let me know. Thanks.