6

I am new to Meteor.js and want to make my web app work with Dropbox Core API. I am not able to wrap my head around making API calls using the HTTP package in Meteor.js

How can I make a call in Meteor which is similar to the Curl call below :

curl https://api.dropbox.com/1/account/info -H "Authorization: Bearer <access token>"

I wish to get list of files in the directory but for now I am stuck with the Authentical Token.

Vaibhav K
  • 832
  • 2
  • 10
  • 16

1 Answers1

11

You can use the HTTP package you mentioned

Add it with

meteor add http

Then to use it (server side). This should produce exactly what the curl request above gives out.

var result = HTTP.get("https://api.dropbox.com/1/account/info", {
             headers: {
                 Authorization: "Bearer <access token>"
             }
});

console.log(result.content)
console.log(result.data) //<< JSON form (if api reports application/json as the content-type header
Tarang
  • 75,157
  • 39
  • 215
  • 276