# How to get json format data without the .json or ?format=json postfix in the url?

**URL:** <https://www.ruby-forum.com/t/how-to-get-json-format-data-without-the-json-or-format-json-postfix-in-the-url/143688>\
**Category:** Rails\
**Created:** [July 21, 2008, 9:06pm UTC](https://www.ruby-forum.com/t/how-to-get-json-format-data-without-the-json-or-format-json-postfix-in-the-url/143688 "2008-07-21T21:06:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fivesheep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e9bcb4/32.png) [@Fivesheep](https://www.ruby-forum.com/u/Fivesheep)\
**Post date:** [July 21, 2008, 9:06pm UTC](https://www.ruby-forum.com/t/how-to-get-json-format-data-without-the-json-or-format-json-postfix-in-the-url/143688/1 "2008-07-21T21:06:38Z")

</div>

I have tried to set the “Accept: application/json” header, but it  
didn’t work. all i could get was the “406 Not Acceptable” status code.

Below was the command what i used to make the request:

curl -i -X POST -H “Content-Type: application/json” -H “Accept:  
application/json” -d “{ title: "foo", body: "bar" }”  
[http://127.0.0.1:3000/posts](http://127.0.0.1:3000/posts)

and here the result:

HTTP/1.1 406 Not Acceptable  
Connection: close  
Date: Mon, 21 Jul 2008 19:03:22 GMT  
Set-Cookie:  
\_xml\_test\_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo  
%0ASGFzaHsGOgtub3RpY2UiI1Bvc3Qgd2FzIHN1Y2Nlc3NmdWxseSBjcmVhdGVk  
%0ALgY6CkB1c2VkewY7BkY%3D–41fbe342052f993cdaebf3ad9c431fb7537e8d4e;  
path=/  
Status: 406 Not Acceptable  
X-Runtime: 0.02510  
Cache-Control: no-cache  
Server: Mongrel 1.1.5  
Content-Type: text/html; charset=utf-8  
Content-Length: 1

if i use [http://127.0.0.1:3000/posts.json](http://127.0.0.1:3000/posts.json) or  
[http://127.0.0.1:3000/posts?format=json](http://127.0.0.1:3000/posts?format=json),  
i would get the proper result.
