I have a custom REST API url:
<route url="/V1/vendor/module/id/:Id" method="GET">
<service class="Vendor\Module\Api\ModuleRepositoryInterface" method="get"/>
<resources>
<resource ref="anonymous"/>
</resources>
</route>
my get method the same as Magento/Catalog : CategoryRepository
GET URL: ...rest/en_gb/V1/vendor/module/id/1
public function get($id, $storeId = null )
{
print_r($id);//OK This prints id = 1
print_r($storeId);die; //NOT printing `en_gb` or store id
$cacheKey = $storeId ?? 'all';
if (!isset($this->instances[$categoryId][$cacheKey])) {
/** @var Category $category */
$category = $this->categoryFactory->create();
if (null !== $storeId) {
$category->setStoreId($storeId);
}
$category->load($categoryId);
if (!$category->getId()) {
throw NoSuchEntityException::singleField('id', $categoryId);
}
$this->instances[$categoryId][$cacheKey] = $category;
}
return $this->instances[$categoryId][$cacheKey];
}
This ?storeId=1
works but it's not as is called in API Native Magento Module/Catalog:
Any Ideas Anyone? Appreciated!