# JSON vs URL Encoded API Calls - JSON returns BAD CSRF

**URL:** <https://meta.discourse.org/t/json-vs-url-encoded-api-calls-json-returns-bad-csrf/22406>\
**Category:** Feature\
**Created:** [22 Novembro , 2014 02:20 UTC](https://meta.discourse.org/t/json-vs-url-encoded-api-calls-json-returns-bad-csrf/22406 "2014-11-22T02:20:09Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [31 Março , 2016 06:53 UTC](https://meta.discourse.org/t/json-vs-url-encoded-api-calls-json-returns-bad-csrf/22406/9 "2016-03-31T06:53:07Z")

</div>

This is not really a bug, it is a feature request, can be achieved with middleware, not built in to Rails.

Not supporting `Content-Type: application/json` does make it slightly more annoying to consume the API via curl and other trivial tools. I am open to adding support for this.

---

_[View the full topic](https://meta.discourse.org/t/json-vs-url-encoded-api-calls-json-returns-bad-csrf/22406)._
