My corresponding configuration is
fos_rest:
view:
view_response_listener: force
sensio_framework_extra:
view:
annotations: false
and it really annoys to specify the route as
@Route("/jobs", defaults={ "_format" = "json" })
every time.
So is it possible to specify it somewhere to be assumed by default?
PS:
If I remove defaults={ "_format" = "json" }
and call the /jobs
endpoint I'm getting an exception
Unable to find template "APIBundle:Jobs:post.html.twig".
PPS:
routing_loader:
default_format: json
won't work because it's only used for automatic routes generation.
The final answer is much easier and is irrelevant to FOS\RestBundle:
api:
resource: "@APIBundle/Controller/"
type: annotation
defaults: {_format: json} # <<<<<<<
prefix: /api/