在经典 ASP 中设置 REST API

Setting up REST API in Classic ASP

我有以下 REST API 文档,我想看看这是否可以在 Classic ASP 中完成。

目的地URL是:

https://sandbox.cal-online.co.il/api/PayCalSDK/VerifyAndActivateForPaymentPage
{ 
    TotalAmount: 1, 
    CurrencyCode: 1,
    TransactionId: GUID, 
    Business: { 
        ApiKey: 'C89371AE-698F-4A15-BD35-2F58377A14F9', // test key 
        Description: ''
    },
    CreditTypes: [ 
        {CreditTypeCode: 1, MaxNumberOfPayments: 1} 
    ] 
}

我有的是:

Set HTTP = CreateObject("MSXML2.serverXMLHTTP")
HTTP.setOption 2, 13056
HTTP.Open "GET", (url), false
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTP.setRequestHeader "Business.ApiKey", "C89371AE-698F-4A15-BD35-2F58377A14F9"
HTTP.setRequestHeader "transactionId", "397653"
HTTP.setRequestHeader "PayCalSDK.CreditType", "1"
HTTP.setRequestHeader "TotalAmount", "20.20"
HTTP.setRequestHeader "CurrencyCode", "1"
HTTP.setRequestHeader "payCalSdkCharge.ApiUrlPath", "http://www.domain.com"
HTTP.send("")
Response.write HTTP.responseText
Set HTTP = nothing 

但是字段的格式有些问题,因为我收到了他们的错误响应:

响应是:

{"message":"An error has occurred."}

正确的语法是什么?

更新:

我也试过这个代码:

key = "C89371AE-698F-4A15-BD35-2F58377A14F9"

url = "https://m.cal-online.co.il/api/PayCalSDK/VerifyAndActivateForPaymentPage?"
str = "{ TotalAmount: 1, CurrencyCode: 1, TransactionId: 36985223, Business: { ApiKey: '" & key & "',Description: '' }, CreditTypes: [ {CreditTypeCode: 1, MaxNumberOfPayments: 1}] }"

Dim oXMLHttp
Set oXMLHttp=Server.Createobject("Msxml2.ServerXMLHTTP.6.0")
oXMLHttp.open "post", url & str,false

oXMLHttp.send
response.write oXMLHttp.responseText
Set oXMLHttp = Nothing

我得到了同样的回复:

{"message":"An error has occurred."}

C/O Lankymart 的评论帮助,试试这个

key = "C89371AE-698F-4A15-BD35-2F58377A14F9"

url = "https://m.cal-online.co.il/api/PayCalSDK/VerifyAndActivateForPaymentPage?"
str = "{ TotalAmount: 1, CurrencyCode: 1, TransactionId: 36985223, Business: { ApiKey: '" & key & "',Description: '' }, CreditTypes: [ {CreditTypeCode: 1, MaxNumberOfPayments: 1}] }"

Dim oXMLHttp
Set oXMLHttp=Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
oXMLHttp.open "POST", url,false
oXMLHttp.setRequestHeader "Content-Type", "application/json"
oXMLHttp.send str
response.write oXMLHttp.responseText
Set oXMLHttp = Nothing