In your routes.rb you can put the POST route in the namespace and define a format that can be expected as follows:
namespace :api, defaults: { format: :json } do post 'example' => 'controller#action' end
In this case, you load your json payload into '/api/example.json' and should not define a Content-Type. You can also define it for only one line of the message, but I have not tested this.
source share