【问题标题】:Need Node js code snippet to get data from Assembla需要 Node js 代码片段从 Assembla 获取数据
【发布时间】:2018-08-27 09:26:12
【问题描述】:

尝试使用 node js rest API 调用从 Assembla 获取数据。 我不确定如何使用 Bearer 令牌进行身份验证并获取 JSON 输出。 有什么方法可以使用 HTTP 请求并按预期获取输出。 请帮忙。

【问题讨论】:

    标签: node.js rest assembla


    【解决方案1】:
     Put your access token in the request to authenticate api and you will get the json data
    
       request({
            method: 'GET',
            uri: 'https://api.assembla.com/v1/spaces',
            auth: {
                bearer: access_token
            }
        }, function (error, response, body) {
            //this contains a json object
        });
    

    【讨论】:

    • 尝试但低于错误 buffer.js:262 throw new TypeError(kFromErrorMsg); TypeError: 第一个参数必须是字符串、Buffer、ArrayBuffer、Array 或类似数组的对象。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 1970-01-01
    • 2021-07-02
    • 2018-03-07
    • 1970-01-01
    相关资源
    最近更新 更多