我正在vbscript中创建以下请求并发送到gocardless沙箱:
url="https://api-sandbox.gocardless.com/"
typ="GET"
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open typ, url, False
xml.setRequestHeader "Authorization", "Bearer " & GCAccessToken
xml.SetRequestHeader "GoCardless-Version", "2015-07-06"
xml.SetRequestHeader "Accept","application/json"
xml.SetRequestHeader "Content-Type", "application/json"
xml.Send
GetGC = xml.responseText
Set xml = Nothing尽管我做了任何调整,但我总是得到的回应是:
{"error":{"message":"not found","errors":[{"reason":"not_found","message":"not found"}],"documentation_url":"https://developer.gocardless.com/api-reference#not_found","type":"invalid_api_usage","request_id":"0AA4000DECCD_AC121CEB1F90_5BE18701_19AD0009","code":404}}任何帮助都将不胜感激。已经成功地为Stripe做了类似的工作,但现在需要使用GC。
发布于 2018-11-07 08:44:25
如果从API读取响应
{
"error": {
"message": "not found",
"errors": [{
"reason": "not_found",
"message": "not found"
}
],
"documentation_url": "https://developer.gocardless.com/api-reference#not_found",
"type": "invalid_api_usage",
"request_id": "0AA4000DECCD_AC121CEB1F90_5BE18701_19AD0009",
"code": 404
}
}该错误似乎是HTTP代码(与RESTful API一样常见)--404 Not Found查看响应中提供的文档链接;
404 没找到。找不到请求的资源,或者经过身份验证的用户无法访问该资源。响应体将解释没有找到哪些资源。
所以问题可能是;
在这个特殊的例子中,我认为这是因为资源不存在,因为代码没有指定资源,只有API的基本URL,它不会构成您可以与之交互的API端点。
查看文献资料,很明显您需要在URL中提供一个有效的端点,在编写本报告时,有15个核心端点可与2个辅助端点进行交互。
例如,创造支付请求/响应看起来是这样的;
POST https://api.gocardless.com/payments HTTP/1.1
{
"payments": {
"amount": 100,
"currency": "GBP",
"charge_date": "2014-05-19",
"reference": "WINEBOX001",
"metadata": {
"order_dispatch_date": "2014-05-22"
},
"links": {
"mandate": "MD123"
}
}
}
HTTP/1.1 201 (Created)
Location: /payments/PM123
{
"payments": {
"id": "PM123",
"created_at": "2014-05-08T17:01:06.000Z",
"charge_date": "2014-05-21",
"amount": 100,
"description": null,
"currency": "GBP",
"status": "pending_submission",
"reference": "WINEBOX001",
"metadata": {
"order_dispatch_date": "2014-05-22"
},
"amount_refunded": 0,
"links": {
"mandate": "MD123",
"creditor": "CR123"
}
}
}不幸的是,问题中提供的代码示例并没有真正做任何事情,因此很难建议您要做什么。最后,我建议重新访问API的文档并查看所提供的样本.
https://stackoverflow.com/questions/53172062
复制相似问题