这是我第一次开始使用Rest API&#39>
我已经尝试了很多资源但却无法实现
根据文档这必须是我的请求标头,请求将是POST
"Authorization": "125THIS123IS123TEST1354",
"cache-control": "no-cache",
"content-type": "application/json"
我已经尝试了很多发送数据但却收到了401 Unauthorized错误。
$.ajax({
type: "POST",
url: 'https://testurl/api/test',
headers: {
'Authorization': '125THIS123IS123TEST1354',
'content-type': 'application/json',
'cache-control': 'no-cache'
},
success: function (data) {
alert('success')
},
failure: function (msg) {
alert(msg);
}
});
我不知道正确的方向还是他们的任何其他方法......
答案 0 :(得分:0)
使用
'Authorization': 'Bearer 125THIS123IS123TEST1354',
对于asp.net web API上的源