【发布时间】:2017-02-16 21:45:00
【问题描述】:
我尝试实现 Slimpay 支付解决方案 API。但是我在这个过程中遇到了问题。
来自这个资源(我从以前的请求中得到):
{
"_links" : {
"self" : {
"href" : "https://api-sandbox.slimpay.net/"
},
"profile" : {
"href" : "https://api-sandbox.slimpay.net/alps/v1"
},
"https://api.slimpay.net/alps#create-orders" : {
"href" : "https://api-sandbox.slimpay.net/orders"
}
}
如何跟踪最后一个资源上的链接以创建 HTTP 发布请求?
我必须发布这个请求:
POST Follow(https://api.slimpay.net/alps#create-orders)
Accept: application/hal+json; profile="https://api.slimpay.net/alps/v1"
Authorization: Bearer token
Content-Type: application/json
我应该如何在 Ajax 中编写我的请求?
我不明白:
POST Follow(https://api.slimpay.net/alps#create-orders)
如果我使用:
$.ajax({
url: 'https://api.slimpay.net/alps#create-orders',
type: 'Post',
contentType: 'application/json,
headers: {'Authorization': 'Bearer ' + token},
dataType: 'json',
==> 这给出了 401。看来我丢失了令牌。
【问题讨论】:
-
如果没有完整解释您的付款处理流程,您根本不清楚您要做什么
-
我尝试遵循此过程:dev.slimpay.com/hapi/browser#create-orders - 我在步骤 # 步骤中阻止:在最后一个资源上关注链接
标签: jquery ajax post request href