createHook: function(scope,callback_url) {
http.open("POST","https://api.bigcommerce.com/"+this.context+"/v2/hooks",false);
http.setRequestHeader("Content-Type","application/json");
http.setRequestHeader("Accept","application/json");
http.setRequestHeader("X-Auth-Client",this.client_id);
http.setRequestHeader("X-Auth-Token",this.access_token);
http.send(JSON.stringify({
scope: scope,
destination: callback_url,
is_active: true
}));
}
此尝试返回状态代码400,其中包含错误设置为"无效标题的JSON对象。"
包括列表挂钩(GET / hooks)在内的任何其他API函数都是成功的。
答案 0 :(得分:0)
我也遇到同样的错误,添加"X-Custom-Auth-Header": "{secret_auth_password}"
后,它会创建成功。 returs 201代码。