How to enable Swagger for instance 2.4.6 in magento? | Community
Skip to main content
August 2, 2023
Question

How to enable Swagger for instance 2.4.6 in magento?

  • August 2, 2023
  • 2 replies
  • 5841 views

I am trying to access swagger using this endpoint https://your_host/swagger but it is redirecting me to login page of Magento . How can I enable swagger for admin account in Magento.

Here I am attaching screen shot for reference of the redirect login page.

I also followed this document to enable swagger : https://dev.to/pabodah/swagger-magento-2-3nf9 but while generating API key I am unable to see Integration Record section on UI of Magento, so I am stuck here. Is there and another to generate key?

Please guide me to resolve this problem

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Adobe Employee
August 2, 2023

Hello @chetnapal,

 

Try to switch your Adobe Commerce instance to Developer mode, you should be able to use Swagger in this mode.

We also have Web APIs specification available here https://developer.adobe.com/commerce/webapi/

 

August 3, 2023

Certainly, Chetna! It seems like you're encountering an issue with authentication when trying to access Swagger with Magento. Here's a possible solution:

Log in to the Admin Panel: First, log in to your Magento Admin account.
Navigate to Integration Section: Go to System > Extensions > Integrations.
Add New Integration: Click on Add New Integration, fill in the required details, and make sure to allow the specific resources needed for Swagger.
Activate Integration: After saving the integration, activate it. You will be provided with an API key.
Configure Swagger: You might need to configure Swagger to use this key. Follow the documentation specific to your Magento version to correctly implement it.
Clear Cache: Clear the Magento cache if needed by running php bin/magento cache:clean.

 

If you are still encountering an issue, make sure that your Magento version is compatible with the steps given in the document you've followed, and that the necessary permissions are properly set for the admin user accessing Swagger. for more information, you can check this : https://developer.adobe.com/commerce/webapi/splunk

November 6, 2023

Hey, I am also facing the same issue.so I tried to first switch my Adobe Commerce instance to Developer mode, but I was not able to use Swagger in this mode and my login page was appearing like below.

 

Even though I am able to login But the Swagger page is not working Showing Error: This page is not working
So I reverted back and followed your steps now the Login page is properly displayed.

But the issue is swagger I am not able to get the swagger page I have tried the steps you mentioned still the swagger page is still not displayed showing the same error.
I have tried it on an incognito window and also cleared the cache page is still displayed.