Я пытаюсь создать cfhttp из запроса curl.Вот запрос:
curl https://url/paymentMethods \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"countryCode": "NL",
"amount": {
"currency": "EUR",
"value": 1000
},
"channel": "Web"
}'
Я создаю функцию для запуска cfhttp:
try{
apiKey = 'myKey';
requestURL = 'https://url/';
merchantAccount = 'myAccount';
amount = {
'value': 1000,
'currency': 'USD'
};
cfhttp(method="GET", url="#requestURL#/paymentMethods", result="data"){
cfhttpparam(name="x-API-key", type="header", value="#apiKey#");
cfhttpparam(name="content-type", type="header", value="application/json");
cfhttpparam(name="merchantAccount", type="formfield", value="#merchantAccount#");
cfhttpparam(name="countryCode", type="formfield", value="US");
cfhttpparam(name="amount", type="formfield", value="#amount#");
cfhttpparam(name="channel", type="formfield", value="web");
}
data = deserializeJSON(charge.data);
WriteDump(data);
} catch(any e){
WriteDump(e);
}
При запуске я получаю ошибку: Ошибка проверки атрибута для CFHTTPPARAM
.Значение атрибута VALUE недопустимо.Требуется строковое значение.
Я неправильно отправляю параметры?
Спасибо