Skip to main content
Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

HTTPie is a recommended alternative to curl because you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

It speaks JSON by default and will handle both setting the necessary header for you as well encoding data as valid JSON. There is also:

Some-Header:value 
Some-Header:value 

for headers, and

name==value 
name==value 

for query string parameters. If you have a large chunk of data, you can also read it from a file have it be JSON encoded:

 [email protected] 
[email protected] 

HTTPie is a recommended alternative to curl because you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

It speaks JSON by default and will handle both setting the necessary header for you as well encoding data as valid JSON. There is also:

Some-Header:value 

for headers, and

name==value 

for query string parameters. If you have a large chunk of data, you can also read it from a file have it be JSON encoded:

 [email protected] 

HTTPie is a recommended alternative to curl because you can do just

http POST http://example.com/some/endpoint name=value name1=value1 

It speaks JSON by default and will handle both setting the necessary header for you as well encoding data as valid JSON. There is also:

Some-Header:value 

for headers, and

name==value 

for query string parameters. If you have a large chunk of data, you can also read it from a file have it be JSON encoded:

[email protected] 
Stick to the facts. Clarify that HTTPie does JSON encoding for you, add example of reading data from file.
Source Link
Mark Stosberg
  • 13.5k
  • 6
  • 48
  • 49

There is awesome HTTPie CLI tool. With it,is a recommended alternative to curl because you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

and so on,It speaks JSON by default and no worrieswill handle both setting the necessary header for you as well encoding data as valid JSON. There is also:

Some-Header:value 

for headers, and

name==value 

for query string parameters.

P.S.

IMHO, the only valid usage of curl is downloading something without persisting it, and just piping it right away to next filter. Example:

$ curl -sSL https://example.com/archive.tar.gz |tar -xzf - - you don't need to persist file if all what If you want is to immediately expand it.

$ curl -sSL https://exapmle.com/script.sh |bash - same, again, but with shell script (don't do that EVER, though).

Note, however, that by "curl" I mean command line utility, not the library. Library awesome by its own. Buthave a large chunk of data, it isyou can also why cli tool is not so usable and handy.

The best utility to just download file and persistread it with same name as remote is wget (1) (or aria2). Period. Please, don't use curl for this. When you do that,from a little pretty kitty dies somewhere in the world.file have it be JSON encoded:

The bet utility to deal with requests when you develop some king of web service (REST API, XML RPC, anything) is HTTPie. Period.

 [email protected] 

There is awesome HTTPie CLI tool. With it, you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

and so on, and no worries. There is also

Some-Header:value 

for headers, and

name==value 

for query string parameters.

P.S.

IMHO, the only valid usage of curl is downloading something without persisting it, and just piping it right away to next filter. Example:

$ curl -sSL https://example.com/archive.tar.gz |tar -xzf - - you don't need to persist file if all what you want is to immediately expand it.

$ curl -sSL https://exapmle.com/script.sh |bash - same, again, but with shell script (don't do that EVER, though).

Note, however, that by "curl" I mean command line utility, not the library. Library awesome by its own. But, it is also why cli tool is not so usable and handy.

The best utility to just download file and persist it with same name as remote is wget (1) (or aria2). Period. Please, don't use curl for this. When you do that, a little pretty kitty dies somewhere in the world.

The bet utility to deal with requests when you develop some king of web service (REST API, XML RPC, anything) is HTTPie. Period.

HTTPie is a recommended alternative to curl because you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

It speaks JSON by default and will handle both setting the necessary header for you as well encoding data as valid JSON. There is also:

Some-Header:value 

for headers, and

name==value 

for query string parameters. If you have a large chunk of data, you can also read it from a file have it be JSON encoded:

 [email protected] 
added 965 characters in body
Source Link
Anthony
  • 2.1k
  • 23
  • 24

There is awesome HTTPie CLI tool. With it, you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

and so on, and no worries. There is also

Some-Header:value 

for headers, and

name==value 

for query string parameters.

P.S.

IMHO, the only valid usage of curl is downloading something without persisting it, and just piping it right away to next filter. Example:

$ curl -sSL https://example.com/archive.tar.gz |tar -xzf - - you don't need to persist file if all what you want is to immediately expand it.

$ curl -sSL https://exapmle.com/script.sh |bash - same, again, but with shell script (don't do that EVER, though).

Note, however, that by "curl" I mean command line utility, not the library. Library awesome by its own. But, it is also why cli tool is not so usable and handy.

The best utility to just download file and persist it with same name as remote is wget (1) (or aria2). Period. Please, don't use curl for this. When you do that, a little pretty kitty dies somewhere in the world.

The bet utility to deal with requests when you develop some king of web service (REST API, XML RPC, anything) is HTTPie. Period.

There is awesome HTTPie CLI tool. With it, you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

and so on, and no worries. There is also

Some-Header:value 

for headers, and

name==value 

for query string parameters.

There is awesome HTTPie CLI tool. With it, you can do just

$ http POST http://example.com/some/endpoint name=value name1=value1 

and so on, and no worries. There is also

Some-Header:value 

for headers, and

name==value 

for query string parameters.

P.S.

IMHO, the only valid usage of curl is downloading something without persisting it, and just piping it right away to next filter. Example:

$ curl -sSL https://example.com/archive.tar.gz |tar -xzf - - you don't need to persist file if all what you want is to immediately expand it.

$ curl -sSL https://exapmle.com/script.sh |bash - same, again, but with shell script (don't do that EVER, though).

Note, however, that by "curl" I mean command line utility, not the library. Library awesome by its own. But, it is also why cli tool is not so usable and handy.

The best utility to just download file and persist it with same name as remote is wget (1) (or aria2). Period. Please, don't use curl for this. When you do that, a little pretty kitty dies somewhere in the world.

The bet utility to deal with requests when you develop some king of web service (REST API, XML RPC, anything) is HTTPie. Period.

Source Link
Anthony
  • 2.1k
  • 23
  • 24
Loading