【发布时间】:2020-01-03 00:02:51
【问题描述】:
我正在编写一个跨平台二维码扫描支付应用程序。我想让我的扫描值发送到需要 json 正文的第三方服务器 api。如何创建发送我的 api post 请求的 if 语句?
我已经尝试结合 qr 值作为键( if qrValue.isNotEmpty == true )实现 if/then ,但从这一点上我完全迷失了。对于这个问题,我似乎找不到我理解的信息来源。
尤其是使用 api 后调用
我需要发送到的网址是:https://api.ext.payconiq.com/v3/payments
邮递员告诉我正文和标题是正确的///
///
var qrValue = "";
var amount = "1";
var callbackurl = "api.vendingshop.nl:1880/ui/rest/payments";
var description = "Test Payment for opening lock";
var reference = "1";
if ( qrValue.isNotEmpty == true){
/* Here needs to come the value for the api input to send and receive the api calls to payconiq*/
}
/*
/* Here comes the "Headers"
content type: application / json
cache control: no cache
Authorization: /*apicode*/
"body"
{
"amount" : "1",
"callbackurl": "api.vendingshop.nl:1880/ui/rest/payments",
"description": "Test payment for opening lock",
"reference": "1"}
;
}
}*/
////
【问题讨论】:
-
你到底想发布什么?请举个例子。
-
我希望这更具可读性: If qrValue == qrValue.IsNotEmpty then http.post json body & json headers