Request using Curl (Windows 10) in Matlab gives error message

Multi tool use
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am sending a curl command to a server, but get an error message which I do not understand.
The request I need to send to the server is
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 TOKEN>"
-d "$body"
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
What I do is that I translate this into a curl command like :
curlcmd = 'curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"'
I send the command via resp = system (curlcmd) via Matlab to the server. What I get as an error message is :
errorMessage: 'Invalid JSON, ParseErrorCode: 4, Message: Missing a name for object member.'
Any idea what this means and how I can solve this ? I am using Matlab on Windows 10, so curl is part of Windows 10.
Response should be a placed order and response data of the trade.
matlab curl
add a comment |
I am sending a curl command to a server, but get an error message which I do not understand.
The request I need to send to the server is
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 TOKEN>"
-d "$body"
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
What I do is that I translate this into a curl command like :
curlcmd = 'curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"'
I send the command via resp = system (curlcmd) via Matlab to the server. What I get as an error message is :
errorMessage: 'Invalid JSON, ParseErrorCode: 4, Message: Missing a name for object member.'
Any idea what this means and how I can solve this ? I am using Matlab on Windows 10, so curl is part of Windows 10.
Response should be a placed order and response data of the trade.
matlab curl
add a comment |
I am sending a curl command to a server, but get an error message which I do not understand.
The request I need to send to the server is
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 TOKEN>"
-d "$body"
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
What I do is that I translate this into a curl command like :
curlcmd = 'curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"'
I send the command via resp = system (curlcmd) via Matlab to the server. What I get as an error message is :
errorMessage: 'Invalid JSON, ParseErrorCode: 4, Message: Missing a name for object member.'
Any idea what this means and how I can solve this ? I am using Matlab on Windows 10, so curl is part of Windows 10.
Response should be a placed order and response data of the trade.
matlab curl
I am sending a curl command to a server, but get an error message which I do not understand.
The request I need to send to the server is
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 TOKEN>"
-d "$body"
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
What I do is that I translate this into a curl command like :
curlcmd = 'curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"'
I send the command via resp = system (curlcmd) via Matlab to the server. What I get as an error message is :
errorMessage: 'Invalid JSON, ParseErrorCode: 4, Message: Missing a name for object member.'
Any idea what this means and how I can solve this ? I am using Matlab on Windows 10, so curl is part of Windows 10.
Response should be a placed order and response data of the trade.
matlab curl
matlab curl
edited Jan 3 at 21:58
Frank S.
asked Jan 3 at 21:42
Frank S.Frank S.
237
237
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy:
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030210%2frequest-using-curl-windows-10-in-matlab-gives-error-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy:
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
add a comment |
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy:
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
add a comment |
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy:
The JSON doesn't seem to be properly quoted.
Try this:
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d "{"order": {"units": "100", "instrument": "EUR_USD", "timeInForce": "FOK", "type": "MARKET", "positionFill": "DEFAULT" }}" "https://api-fxpractice.oanda.com/v3/accounts/AccountID/orders"
Test with Proxy
With the appropriate escape of the JSON quotes, as shown in the above CURL command line, the JSON looks correct when viewed in an HTTPS proxy:
edited Jan 3 at 22:47
answered Jan 3 at 22:41
Stephan SchlechtStephan Schlecht
5,06511013
5,06511013
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
add a comment |
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
Applaus, Applaus and thank you. Worked right away !!!
– Frank S.
Jan 4 at 12:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030210%2frequest-using-curl-windows-10-in-matlab-gives-error-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
S7tow,IOVOhb