Error is "message": "Internal Error. Details are available in Magento log file. Report ID: webapi-5dee36e254394".
When you run http://localhost:8888/magento/rest/V1/position/1
Need to get result from "position" column.
Api is for retrieving a column field by given user input.
<?php
namespace SimpleMagento\Custom\Model;
use SimpleMagento\Custom\Api\InfoLinkInterface;
use SimpleMagento\Custom\Model\ResourceModel\Info\CollectionFactory; //Collection file
use SimpleMagento\Custom\Model\InfoFactory; //Implemented getter setter model
class InfoLink implements InfoLinkInterface
{
private $collection;
private $infoFactory;
public function __construct(CollectionFactory $collection,InfoFactory $infoFactory)
{
$this->collection=$collection;
$this->infoFactory=$infoFactory;
}
/**
* @param int $id
* @return \SimpleMagento\Custom\Api\Data\InfoInterface[]
*/
public function getInfo($id)
{
return $this->infoFactory->create()->getCollection()->addFieldToFilter('entity_id',$id)->getData();
//return $this->infoFactory->create()->getData('position')->addFieldToFilter('entity_id',1);
}
}
?>
webapi.xml is
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/position/:id" method="GET">
<service class="SimpleMagento\Custom\Api\InfoLinkInterface" method="getInfo"/>
<resources>
<resource ref="anonymous" />
</resources>
</route>
2019-12-09 12:57:41] main.CRITICAL: Report ID: webapi-5dee44c52bdb3; Message: Class SimpleMganeto\Custom\Model\InfoLink does not exist {"exception":"[object] (Exception(code: -1): Report ID: webapi-5dee44c52bdb3; Message: Class SimpleMganeto\\Custom\\Model\\InfoLink does not exist at /Applications/MAMP/htdocs/magento/vendor/magento/framework/Webapi/ErrorProcessor.php:205, ReflectionException(code: -1): Class SimpleMganeto\\Custom\\Model\\InfoLink does not exist at /Applications/MAMP/htdocs/magento/vendor/magento/framework/Code/Reader/ClassReader.php:19)"} []