Expand my Community achievements bar.

How to enable Swagger for instance 2.4.6 in magento?

Avatar

Level 1

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.

ChetnaPal_0-1690969695487.png

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

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Employee

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/

 

Avatar

Level 1

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

Avatar

Level 1

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.

 

image (2).png

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.
image (6).png
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.image (7).png
I have tried it on an incognito window and also cleared the cache page is still displayed.