Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从javascript更新google联系人时出现问题_Javascript_Node.js_Google Contacts Api - Fatal编程技术网

从javascript更新google联系人时出现问题

从javascript更新google联系人时出现问题,javascript,node.js,google-contacts-api,Javascript,Node.js,Google Contacts Api,我在nodejs中使用发送PUT请求来更新联系人 unirest.put(url) .header({ 'Authorization': 'Bearer '+result.profileData.split('?access_token=')[1], 'If-Match': '*', }) .send({"entry":{"phoneNumber":req.body.mobile}}) .end(function (res1) {

我在nodejs中使用发送PUT请求来更新联系人

unirest.put(url)
    .header({
        'Authorization': 'Bearer '+result.profileData.split('?access_token=')[1],
        'If-Match': '*',
    })
    .send({"entry":{"phoneNumber":req.body.mobile}})
    .end(function (res1) {
        res.send(res1);
    });
}
我得到响应:
Object{statusCode:415,body:“内容类型application/x-www-form-urlcoded不是有效的输入类型。”,headers:Object,request:Object}

我以
.send({“entry”:{“phoneNumber”:req.body.mobile}})的形式发送数据
,我不确定这是正确的格式


我没有找到任何基于javascript的。如果您需要帮助,我们将不胜感激。

您似乎需要提供内容类型标题。因此,将其添加到传递到.headers方法的对象中,值为json/application

...
.headers({
  "Content-Type": "application/json",
  ...
})
...

看起来您需要提供一个内容类型标题。因此,将其添加到传递到.headers方法的对象中,值为json/application

...
.headers({
  "Content-Type": "application/json",
  ...
})
...

现在正在更新,但将联系人号码设置为清空您的错误消息是什么?另外,您通常可以从与之交互的API的API文档中找到正确的请求正文格式。如果可以访问,请阅读API的源代码。API文档非常糟糕,它现在正在更新,但将联系人号码设置为清空错误消息?另外,您通常可以从与之交互的API的API文档中找到正确的请求正文格式。如果可以访问,也可以阅读API的源代码。API文档非常糟糕