0

How to I solve this error I get in rails development.log:

ActionController::UnknownFormat (PostsController#index is missing a template for this request format and variant.

request.formats: ["application/vnd.api+json"]
request.variant: []):

What I'm doing

I'm trying out the jsonapi resources gem with rails 5.1 with curl. There's a demo app https://github.com/cerebris/peeps for reference.

curl -i -H "Accept: application/vnd.api+json" -H 'Content-Type:application/vnd.api+json' 'http://localhost:3000/posts?user_email=example@example.net&user_token=ZuqysdFsH5pfhAUTDpe3'
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80

1 Answers1

2

You probably need to register the mime type ("application/vnd.api+json") here: https://github.com/cerebris/peeps/blob/master/config/initializers/mime_types.rb

Note that the correct mimetype for json is "application/json", changing your curl command to using the standard mime type might even work out of the box.

murb
  • 1,736
  • 21
  • 31