weixin_33728268 2019-04-15 21:40 采纳率: 0%
浏览 46

Ajax 415响应-Tango API

I'm currently experimenting on Tango's testing console for their API. However, when I open the browser's console on that page and run the following code snippet I keep getting a 415 error response.

$.ajax({
url: "https://integration-api.tangocard.com/raas/v2/customers",
type: "POST",
headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Basic UUFQbGF0Zm9ybTI6YXBZUGZUNkhOT05wRFJVajNDTEdXWXQ3Z3ZJSE9OcERSVVlQZlQ2SGo=' 
},
data: {
    "customerIdentifier": "dummy475",
    "displayName": "dummy475"
},
success: function(response){
    console.log(response);
}
});

The authorization and everything else is straight forward, I'm simply using the provided example data. Any ideas why I'm receiving this error?

  • 写回答

1条回答 默认 最新

  • weixin_33725126 2019-04-16 04:26
    关注

    Its working fine with the Postman. May be you are missing Content-Type in headers.

    headers: { 
               'Content-Type': 'application/json' 
             },
    
    评论

报告相同问题?