Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unable to retrieve API documentation" on admin of api-platform

I trying to use all features of api-platform to test this solution. I don't want use the docker stack to understand the construction.

My test API is now created and useable.

apihttps://ibb.co/hcjyrJ

Entrypoint: http://api.localhost

My problem is when i will install admin with the official tutorial.

  • I don't have any error or warning during installation with yarn

api installhttps://ibb.co/gmK1dy

  • I have modified the src/App.js file with my entrypoint

api jshttps://ibb.co/nQKHJy

  • I have modify API CORS HTTP Headers to allow the admin's domain to access it. The admin's domain is http://localhost:3000

api corshttps://ibb.co/niH7kd

When I try to access to admin : http://localhost:3000, I have the message Unable to retrieve API documentation.

I don't have any message in console. If I check my network tab, I can view the call to the API with the correct response.

api adminhttps://ibb.co/injbdy

If you have any ideas.. I get them all !

like image 224
Vincent Faliès Avatar asked Mar 07 '23 04:03

Vincent Faliès


1 Answers

I've found the solution at this problem.

In nelmio_cors.yaml, you must add Link in expose_headers.

The file must look like as:

nelmio_cors:
defaults:
    origin_regex: true
    allow_origin: ['*']
    allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
    allow_headers: ['Content-Type', 'Authorization']
    expose_headers: ['Content-Disposition', 'Content-Length', 'Link']
    max_age: 3600
paths:
    '^/': ~
like image 198
Vincent Faliès Avatar answered Apr 01 '23 07:04

Vincent Faliès