I had another error running commands from Windows Powershell using both curl.exe and Invoke-WebRequest:
curl.exe -X PUT -d "some_metric 3.14" http://localhost:9091/metrics/job/some_job
echo "some_metric 10" | Invoke-WebRequest -Uri http://localhost:9091/metrics/job/some_job -Method POST
Here is the error message:
text format parsing error in line 1: unexpected end of input stream
I found out that it does not pass line feed which is necessary according to the official document:
Note that in the text protocol, each line has to end with a line-feed character (aka 'LF' or '\n'). Ending a line in other ways, e.g. with 'CR' aka '\r', 'CRLF' aka '\r\n', or just the end of the packet, will result in a protocol error.
so I put a line feed at the end of data, and it works now:
curl.exe -X PUT -d "some_metric 3.14
>> " http://localhost:9091/metrics/job/some_job
As alternative I could also run with Invoke-WebRequest command:
echo "some_metric 20
>> " | Invoke-WebRequest -Uri http://localhost:9091/metrics/job/some_job -Method POST