Category

Rest

Why I chose HTTPie instead of cURL on the Command Line for HTTP APIs

HTTPie (pronounced aitch-tee-tee-pie) is a command line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible.

cURL is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

The biggest difference between cURL and HTTPie is in the response, which is automatically color-coded and JSON is formatted. These defaults make HTTPie very friendly to my tired developer eyes.

cURL POST Example:

HTTPie POST Example:

JSON APIs are common, so HTTPie assumes that’s what’s coming.

cURL GET Example:

HTTPie GET Example:

When the METHOD argument is omitted from the command, HTTPie defaults to either GET (with no request data) or POST (with request data).

You can find here https://httpie.org/doc more information about HTTPie.