创建挂钩失败:标头无效

时间:2014-12-05 10:20:38

标签: asp-classic jscript bigcommerce

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函数都是成功的。

1 个答案:

答案 0 :(得分:0)

我也遇到同样的错误,添加"X-Custom-Auth-Header": "{secret_auth_password}"后,它会创建成功。 returs 201代码。