# 406 Not Acceptable response

**URL:** <https://www.ruby-forum.com/t/406-not-acceptable-response/169373>\
**Category:** Rails\
**Created:** [June 2, 2009, 11:15pm UTC](https://www.ruby-forum.com/t/406-not-acceptable-response/169373 "2009-06-02T23:15:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flavio\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/8baadc/32.png) [@Flavio\_M](https://www.ruby-forum.com/u/Flavio_M)\
**Post date:** [June 2, 2009, 11:15pm UTC](https://www.ruby-forum.com/t/406-not-acceptable-response/169373/1 "2009-06-02T23:15:00Z")

</div>

I want to send a response in a content type that is not listed in the  
request Accept header. When I try to do this in Rails a response of  
status code 406 Not Acceptable is sent. I would like to know how to do  
this.

Ps: A example of a API that do this is the Sun Cloud API, where the  
errors are sent in a specific media type ([http://kenai.com/projects/](http://kenai.com/projects/)  
suncloudapis/pages/CommonBehaviors#Data\_Models).

---

<div class="post-metadata">

**Author:** ![Flavio\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/8baadc/32.png) [@Flavio\_M](https://www.ruby-forum.com/u/Flavio_M)\
**Post date:** [June 3, 2009, 8:39am UTC](https://www.ruby-forum.com/t/406-not-acceptable-response/169373/2 "2009-06-03T08:39:37Z")

</div>

On Tue, Jun 2, 2009 at 10:33 PM, Flavio M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I want to send a response in a content type that is not listed in the  
> request Accept header. When I try to do this in Rails a response of  
> status code 406 Not Acceptable is sent. I would like to know how to do  
> this.
> 
> Ps: A example of a API that do this is the Sun Cloud API, where the  
> errors are sent in a specific media type ([http://kenai.com/projects/](http://kenai.com/projects/)  
> suncloudapis/pages/CommonBehaviors#Data\_Models).

Add :status =\> 406 to your render call:

render …, :status =\> 406

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)

[http://MyMvelope.com](http://MyMvelope.com) - The SIMPLE way to manage your savings
