相关文章推荐
很酷的钢笔  ·  ORDER BY 子句 ...·  1 年前    · 
谦和的电影票  ·  datagridview日期排序C#·  1 年前    · 
忐忑的土豆  ·  make makefile cmake ...·  2 年前    · 
淡定的楼梯  ·  c# combobox ...·  2 年前    · 
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 .

What name/value pairs does the remote end expect? There's no one input that particular JSON maps to. chepner Sep 13, 2018 at 20:37

For application/x-www-form-urlencoded you could try:

curl -d "param1=value1&param2=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&param2=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.