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"}