public function details(int $customerId = 0)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customer = $objectManager->get(\Magento\Customer\Model\Customer::class);
$customer = $customer->load($customerId);
$customerDetails = new CustomerDetails();
$fileSystem = $objectManager->get(\Magento\Framework\Filesystem::class);
$mediaDir = $fileSystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::ROOT)->getAbsolutePath().'pub/media/';
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$url = $storeManager->getStore()->getBaseUrl().'pub/media/sk_profile_pic/default.png';
if($customer->get('sk_profile_pic') && !empty($customer->getData('sk_profile_pic'))){
if(file_exists($mediaDir.'sk_profile_pic/'.$customer->getData('sk_profile_pic'))){
$url = $storeManager->getStore()->getBaseUrl().'pub/media/sk_profile_pic/'.$customer->getData('sk_profile_pic');
}
}
$customerDetails->setSkProfilePic($url);
$url = $storeManager->getStore()->getBaseUrl().'pub/media/sk_store_pic/default.png';
if($customer->getData('sk_store_pic') && !empty($customer->getData('sk_store_pic'))){
if(file_exists($mediaDir.'sk_store_pic/'.$customer->getData('sk_store_pic'))){
$url = $storeManager->getStore()->getBaseUrl().'pub/media/sk_store_pic/'.$customer->getData('sk_store_pic');
}
}
$customerDetails->setSkStorePic($url);
return $customerDetails;
}
Hi, so i have this magento API that returns profiles images which i call through : myhostexample.com/V1/customers/details?customerId=1941 but what i receive is
{
"message": "The \"details\" value's type is invalid. The \"int\" type was expected. Verify and try again.",
"trace": null}
the error indicates that the parametres is expecting an int but that's why i actually gave it,so i can't really understand the error message even with some googling i got nothing. Thank you!