[英]How to convert hash into text from the response of Live API for Contacts
[英]How to create contacts with Live REST API?
我在使用Java的Live REST API上遇到了一个真正的问题。
确实,我正在尝试从用户ID(登录后)获取联系人并插入新联系人。 但是我有一个“标题”问题。
这是我的连接功能:
$(window).ready(function() {
$("#ifConnect").hide();
WL.login({
scope: "wl.signin, wl.basic, wl.emails, wl.contacts_create"
}).then(
function (response) {
loadContacts(); //which load properly my contacts
}
);
});
这是我的创建联系方式:
var contact = {
first_name: "First",
last_name: "Last"
};
WL.api({
path: "me/contacts",
method: "POST",
body: contact
}).then(
function (response) {
alert(JSON.stringify(response));
},
function (response) {
alert(JSON.stringify(response));
}
);
不幸的是,调用了第二个函数,并且给了标题警报: {"error":{"code":"request_body_invalid_media_type","message":"The request doesn't include a Content-Type header."}}
有人可以帮助我吗? 非常感谢 !
错误描述非常有用。 尝试将Content-Type设置为application / json或将主体放在此示例中:
function (response) {
WL.api({
path: "me/contacts",
method: "POST",
body: {
"first_name": "First",
"last_name": "Last"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.