# # Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html # fos_rest: # param_fetcher_listener: true # allowed_methods_listener: true # routing_loader: true # view: # view_response_listener: true # format_listener: # rules: # - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] } fos_rest: param_fetcher_listener: true body_listener: true format_listener: true view: view_response_listener: force body_converter: enabled: true validate: true exception: codes: 'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404 'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT 'App\Exception\BadRequestDataException': HTTP_BAD_REQUEST messages: 'Symfony\Component\Routing\Exception\ResourceNotFoundException': true 'App\Exception\BadRequestDataException': true # exception_controller: 'fos_rest.exception.controller:showAction' # format_listener: ~ # rules: # - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] } #- { path: '^/', priorities: ['json'], fallback_format: 'json', prefer_extension: true } sensio_framework_extra: # view: { annotations: true } router: { annotations: true } request: { converters: true } twig: exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction' # FROM https://www.sgalinski.de/typo3-agentur/technik/how-to-create-a-basic-rest-api-in-symfony/ # fos_rest: # param_fetcher_listener: true # view: # view_response_listener: 'force' # formats: # xml: true # json: true # templating_formats: # html: true # format_listener: # rules: # - { path: ^/, priorities: [ json, xml, html ], fallback_format: ~, prefer_extension: true } # exception: # codes: # 'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404 # 'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT # 'SGalinski\TypoScriptBackendBundle\Exception\BadRequestDataException': HTTP_BAD_REQUEST # messages: # 'Symfony\Component\Routing\Exception\ResourceNotFoundException': true # 'SGalinski\TypoScriptBackendBundle\Exception\BadRequestDataException': true # allowed_methods_listener: true # access_denied_listener: # json: true # body_listener: true # disable_csrf_role: ROLE_API