Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
This question does not appear to be about
a specific programming problem, a software algorithm, or software tools primarily used by programmers
. If you believe the question would be on-topic on
another Stack Exchange site
, you can leave a comment to explain where the question may be able to be answered.
Closed
3 years ago
.
–
For
application/x-www-form-urlencoded
you could try:
curl -d "param1=value1¶m2=value2" -X POST http://localhost:3000/blahblah
Where param1=value...
have to be your JSON data as chicago=123&boston=245
Or explicit form:
curl -d "param1=value1¶m2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/blahblah
Instead of http://localhost:3000/blahblah
you should provide real URL of your service.
The whole point of curl -F
, according to the man page, is "to POST data using the Content-Type multipart/form-data according to RFC 2388." In other words, it's best used when you need to emulate an HTML form with a file input.
Instead use curl -d
to specify the raw POST data:
curl -d '{"cities":{"chicago":123,"boston":245}}' https://example.com
If this is actually how they expect data, it is a misconfigured server, as x-www-form-urlencoded
data should be in the form key=value
.