Response Formats¶
The default response format is text/plain. you can change this behavior by sending an Accept header with one of the following values:
text/html¶
curl -H "Accept: text/html" -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/html
<!DOCTYPE html>
<html>
...
<body>
...
<pre>Agent Awesome</pre>
</body>
</html>
Note
The HTML example here is trimmed to save space, to view the output, just visit any of the API endpoints with your web browser.
text/plain¶
curl -H "Accept: text/plain" -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Agent Awesome
application/php¶
curl -H "Accept: application/php" -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: application/php
a:1:{s:10:"user-agent";s:13:"Agent Awesome";}
application/xml¶
curl -H "Accept: application/xml" -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: application/xml
<?xml version="1.0" encoding="utf-8"?>
<response><user-agent>Agent Awesome</user-agent></response>
application/json¶
curl -H "Accept: application/json" -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: application/json
{"user-agent":"Agent Awesome"}
API Reference¶
/ip¶
Returns Origin IP
curl "httpconsole.com/ip"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
159.33.10.155
/agent¶
Returns user-agent.
curl -H "User-Agent: Agent Awesome" "httpconsole.com/agent"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Agent Awesome
/headers¶
Returns the request headers
curl -H "User-Agent: Agent Awesome" "httpconsole.com/headers"
Response:
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Host: httpconsole.com
Accept: */*
User-Agent: Awesome Browser
/status¶
Returns given HTTP Status code.
Parameters:
/status/:code/:reason
Key | Format | Default | Description |
---|---|---|---|
:code | [0-9]+ | 200 | HTTP Status Code |
:reason | [a-zA-Z0-9 %_-]+ | OK | HTTP Status Reason |
curl "httpconsole.com/status/505/Hello World"
Response:
HTTP/1.1 505 Hello World
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Hello World
/delay¶
Delays responding for n seconds.
Parameters:
/delay/:seconds
Key | Format | Default | Description |
---|---|---|---|
:seconds | [0-9]+ | 1 | number of seconds to wait before sending a response |
curl "httpconsole.com/status/505/Hello World"
Response:
HTTP/1.1 505 Hello World
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Hello World
/redirect¶
Redirects n times.
Parameters:
/redirect/:code/:count
Key | Format | Default | Description |
---|---|---|---|
:code | 301|302|303|307 | 302 | HTTP Status Code |
:count | [0-9]+ | 1 | number of times to redirect |
curl "httpconsole.com/redirect/302/5"
Response:
HTTP/1.1 302 Found
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Location: http://httpconsole.com/redirect/302/4
/text¶
Returns the text message passed in the URL
Parameters:
/text/:message
Key | Format | Default | Description |
---|---|---|---|
:code | [a-zA-Z0-9 %_-]+ | Hello World | Text message to return |
curl "httpconsole.com/text/Hello"
Response:
HTTP/1.1 302 Found
Date: Wed, 02 Apr 2014 18:39:48 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
Hello
HTTP Console¶
HTTP Console is a free HTTP debugging service with multiple endpoints to help test and debug HTTP operations clients with various Response Formats:
try it out:
curl "http://httpconsole.com/request"
refer to the API Reference for a full listing of all possible end-points.