如何翻译下面的curl
代码并从post
中的rest-template
进行spring-boot
调用?
curl -X POST \
https://myserver.com:8124/rest/v1/transfer \
-H 'Authorization: bearer <generated token to be passed here>'\
-H 'Content-Type: application/json' \
-d '{
"debitAccountNo":"1234567",
"transferDetails":[
{
"accountNo":"123456",
"ifscCode":"ABCD0000001",
"accountName":"test",
"purpose":"test transfer",
"amount":{
"value":"100",
"currency":"INR"
},
"batchId":"batch1",
"referenceId":"merchantuniquerefid1",
"transferType":"NEFT",
"accountVPA":"",
"retry":true
}
]
}'
如果主体是单个对象,则可以使用Map
。当主体是具有嵌套对象的对象列表的对象时,该如何处理?
在这些情况下如何使用RestTemplate
?