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?
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?
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);
}