• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

httpie Command Examples in Linux

by admin

httpie is a command-line tool for making HTTP requests. It is designed to be user-friendly and intuitive, making it easy for developers to make and debug HTTP requests from the command line. httpie is built on top of the popular Python library requests and provides features such as syntax highlighting, JSON and form data support, and a built-in help system.

httpie allows you to send HTTP requests using the standard verbs such as GET, POST, PUT, DELETE, etc. and provides many options to customize the requests. httpie also provides features such as syntax highlighting for JSON and XML responses, automatic decompression of gzip and deflate encoded responses, and support for multipart file uploads. It also supports the use of environment variables and custom configuration files, to keep sensitive information like api keys, secrets etc.

httpie also has a built-in help system that allows you to see the available options and usage examples for each command. It’s worth noting that httpie is not the only tool for sending HTTP requests from the command line, other similar tools like curl, http-prompt etc. But httpie stands out for its user-friendly interface, and the additional features it provides, it’s very popular among developers because of its simplicity and ease of use.

httpie Command Examples

1. Send a GET request (default method with no request data):

# http https://example.com

2. Send a POST request (default method with request data):

# http https://example.com hello=World

3. Send a POST request with redirected input:

# http https://example.com < file.json

4. Send a PUT request with a given JSON body:

# http PUT https://example.com/todos/7 hello=world

5. Send a DELETE request with a given request header:

# http DELETE https://example.com/todos/7 API-Key:foo

6. Show the whole HTTP exchange (both request and response):

# http -v https://example.com

7. Download a file:

# http --download https://example.com

8. Follow redirects and show intermediary requests and responses:

# http --follow --all https://example.com

Filed Under: Linux

Some more articles you might also be interested in …

  1. chkconfig Command Examples in Linux
  2. git delta: List files that differ from another branch
  3. How to Remove/Delete All Packages from Channel(s) in SpaceWalk
  4. How to configure xhost to be persistent across reboots in Linux
  5. mktemp: command not found
  6. qm clone Command Examples in Linux
  7. LVM error “WARNING: Inconsistent metadata found” – How to resolve in CentOS / RHEL
  8. pamac Command Examples in Linux
  9. KVM Virsh Command Examples on CentOS and RHEL
  10. jpegtran for image optimization

You May Also Like

Primary Sidebar

Recent Posts

  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright