【发布时间】:2018-05-22 21:25:26
【问题描述】:
我有以下 curl 命令,我需要使用 Matlab 和使用 POST 的 webwrite 将其发送到 Web 服务器。我的问题是我总是得到一个“错误请求”的答案,所以我的语法一定是错误的。有谁知道这个 curl 命令如何以正确的方式使用 webwrite 在 Matlab 中发送正文?
body=$(cat << EOF
{
"order": {
"units": "100",
"instrument": "EUR_USD",
"timeInForce": "FOK",
"type": "MARKET",
"positionFill": "DEFAULT"
}
}
EOF
)
curl \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <AUTHENTICATION TOKEN>" \
-d "$body" \
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
【问题讨论】: