QuestionQ4

APIs and Services

An Adobe Commerce developer has added a new API method to search for and retrieve a list of Posts for a custom Blog feature.

This is the module’s etc/webapi.xml file:

Question Image

The new code has been deployed to production, and the merchant is using https://merchant.domain.com/swagger to review the new endpoint, but it is not displayed in Swagger.

What could explain this?

  • A The webapi.xml file should be moved into the etc/webapi_rest/webapi.xml file.
  • B Since the new endpoint is not anonymous, the merchant needs to enter a valid integration token in swagger in order to see the new method.
  • C The @return annotation is missing in the MyVendor\Blog\Api\PostRepositoryInterface class.
Explanation

Swagger displays documentation for anonymous resources by default. This route is protected by the MyVendor_Blog::Post_view ACL resource, so Swagger will display it only after a valid token belonging to a user or integration authorized for that resource is entered.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!