0

In Magento 2.4, I am using custom API and it is giving the below error.

{
"message": "Class string does not exist",
"code": -1
}

I have tried this and this solution. But nothing worked. Any solution for this?

asked Apr 18, 2023 at 12:03
1
  • Can you share code? Commented Apr 18, 2023 at 21:49

1 Answer 1

0

I found the issue. In my case, It is due to the return type of the response specified in the Interface file(Usually at Api/Interface.php).

Sample code:

here it is: @return \Vendor\Module\Api\Data\ResponseDataInterface

<?php
namespace Vendor\Module\Api;
interface SampleInterface
{
/**
 * GET for Post api
 * @param string $customerId
 * @return \Vendor\Module\Api\Data\ResponseDataInterface
 */
public function getDetails($customerId);

}

answered Apr 19, 2023 at 15:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.