NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: ntnewbies on August 16, 2021, 02:09:42 AM
-
hi everyone
i am making an api call and i need to provide some json info inside the post data
postdata = st.getvalue()
posturl = 'api.testdata.payme'
net.post(posturl,postdata)
sample post data:
{
"order" : {
"amountOfMoney" : {
"currencyCode" : "USD",
"amount" : 2345
},
"customer" : {
"merchantCustomerId" : "1234",
"billingAddress" : {
"countryCode" : "US"
}
}
},
"hostedCheckoutSpecificInput" : {
"variant" : "testVariant",
"locale" : "en_GB"
}
}
usd, 234, 1234, US should be variables.
how do i put it inside string theory?
i have tried the following way but compiler gives error of misused of {{
st.setvalue('{order": {"amountOfMoney" : {"currencyCode" : "' & LOC:CurrencyCode & '","amount" : ' & LOC:Amount......&'}}'
regards,
Jason
nt11.53
c11
-
Hi Jason,
Use {{ to escape the single { in clarion code.
Don't do it for }
Regards
Bill
-
also, there's no need to move the string from the stringtheory object, to a (possibly too small) string. ie
postdata = st.getvalue()
posturl = 'api.testdata.payme'
net.post(posturl,postdata)
can be replaced with
posturl = 'api.testdata.payme'
net.post(posturl,st)
Cheers
Bruce
-
thanks bill and bruce for the tip.
will try again.
jason