kennethreitz.org / Software / Websites / Httpbin

httpbin.org

httpbin.org is a simple HTTP request and response service. It is a useful tool for testing HTTP clients and debugging webhooks. The service provides a variety of endpoints that return different types of data, such as headers, IP address, and user-agent.

Features

Running with Docker

You can also run httpbin.org locally using Docker. First, pull the httpbin image from Docker Hub:

$ docker pull kennethreitz/httpbin

Then, run the httpbin container:

$ docker run -p 80:80 kennethreitz/httpbin

This will start the httpbin service on port 80 of your local machine, allowing you to interact with it using your HTTP client of choice.

Usage

You can interact with httpbin.org using various HTTP clients, such as cURL, Python requests, or Postman. Here are some examples of how you can use the service:

GET Request

To make a GET request to httpbin.org, you can use cURL:

$ curl https://httpbin.org/get

This will return a JSON response containing details of the request, such as headers, origin, and URL.

POST Request

To make a POST request to httpbin.org with data, you can use cURL:

$ curl -X POST https://httpbin.org/post -d "key1=value1&key2=value2"

This will return a JSON response containing the data you posted.

Authentication

To make an authenticated request to httpbin.org, you can use cURL with basic authentication:

$ curl -u username:password https://httpbin.org/basic-auth/username/password

This will return a JSON response indicating whether the authentication was successful.