Skip to content

It's Ready: Format "json" is not supported in default api_platform config #1845

Closed
@mikespub

Description

@mikespub

In the "Getting Started" documentation section "It's Ready" it states:

If you access any API URL with the .html extension appended, API Platform displays the corresponding API request in the UI. Try it yourself by browsing to https://localhost/greetings.html.
...
For instance, go to https://localhost/greetings.jsonld to retrieve the list of Greeting resources in JSON-LD, or to https://localhost/greetings.json to retrieve data in raw JSON.

With an out of the box installation both greetings.html and greetings.jsonld work as described, but greetings.json returns this error:

{"title":"An error occurred","detail":"Format \"json\" is not supported","status":404,"type":"\/errors\/404","trace":[{"file":"\/app\/vendor\/api-platform\/core\/src\/State\/Provider\/ContentNegotiationProvider.php","line":51,"function":"getRequestFormat","class":"ApiPlatform\\State\\Provider\\ContentNegotiationProvider","type":"->"},{"file":"\/app\/vendor\/api-platform\/core\/src\/Symfony\/Controller\/MainController.php","line":74,"function":"provide","class":"ApiPlatform\\State\\Provider\\ContentNegotiationProvider","type":"->"},{"file":"\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":181,"function":"__invoke","class":"ApiPlatform\\Symfony\\Controller\\MainController","type":"->"},{"file":"\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":76,"function":"handleRaw","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->"},{"file":"\/app\/vendor\/symfony\/http-kernel\/Kernel.php","line":197,"function":"handle","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->"},{"file":"\/app\/vendor\/symfony\/runtime\/Runner\/Symfony\/HttpKernelRunner.php","line":35,"function":"handle","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"->"},{"file":"\/app\/vendor\/autoload_runtime.php","line":29,"function":"run","class":"Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner","type":"->"},{"file":"\/app\/public\/index.php","line":5,"function":"require_once"}]}

When looking at the api_platform.yaml file I only see jsonld defined as format, not json - are the default config and documentation no longer aligned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions