Hello,
This works:
curl --url http://someurl.tld --form "apikey=39485730"
This does not:
curl --url http://someurl.tld --form "apikey=<keyfile"
Error:
Invalid API keys
The cURL manual (http://curl.haxx.se/docs/manpage.html) explicitly states
-F/--form (HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. [...] To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.
FWIW:
If I use --form "apikey=@keyfile" I get the error: "API key is required".
This confirms that @ is definately wrong (which I am okay with).
But why does <
not work, and what to do about it?
It looks as if the content of the file is either not passed on, or wrong. Thus I've made quadruple sure, that only the api key (here: 39485730) and nothing else is in the file.
If it's important why I am trying to do this:
I need this curl-command in scripts, and don't want to put the API key there. Instead, it should be in the HOME of the user who runs this script, only readable by him, and nobody else.
Thank you in advance for any insight... :-)