How to make a CURL call to Dropbox API using Meteor.js

前端 未结 1 1085
傲寒
傲寒 2021-01-12 15:20

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

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 15:37

    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 "
                 }
    });
    
    console.log(result.content)
    console.log(result.data) //<< JSON form (if api reports application/json as the content-type header
    

    0 讨论(0)
提交回复
热议问题