cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to parse /upload endpoint's response when using pipes in node

How to parse /upload endpoint's response when using pipes in node

danthedev
Explorer | Level 3

Hello 

 

I am piping users request to /upload api endpoint. The file is saved properly, however I can't seem to handle server's response.

 

As you can see from the picture below, my (probably naive) approach ends up in unreadable sequence of characters. Am I missing something here? 

 

Thanks

 

image.png

4 Replies 4

Greg-DB
Dropbox Staff
We can't offer much help with Node itself or using pipes in Node in particular, but for reference, the Dropbox API /2/files/upload endpoint returns the uploaded file metadata as JSON in the HTTPS response body. Exactly what you do with that and how you handle it is up to you, so you may be better helped by asking for general Node help for handling data like this in a Node forum or on StackOverflow.

thelwang
Helpful | Level 7

maybe the reply from DropBox is gzip or deflate compressed? look for the "Content-Encoding" header in the REQUEST youre making.  Though not really sure what is up with node pipes maybe its so low level you have to do your own http parsing or something.  But in general read the request and response headers to help figure out whats going on.

 

if thats right then just stop the "Accept-Encoding" header from sending to dropbox when you make the request.  You must be sending that already to get a compressed response. Avoiding sending thatll make the reply normal and not globelgook.

danthedev
Explorer | Level 3

Thanks! I will dig into this

danthedev
Explorer | Level 3

Thanks for the answer, if nothing helps I will resort to SO 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    danthedev Explorer | Level 3
  • User avatar
    thelwang Helpful | Level 7
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?