I am building a small webapp with PHP and jlevers/selling-partner-api (https://github.com/jlevers/selling-partner-api).
I need to recover the ASIN starting from EAN code.
I have tried this:
$catalogApi = $connector->catalogItems();
try {
// EAN code of a product
$ean = '3578830113254';
$marketplaceId = 'APJ6JRA9NG5V4';
$includedData = ["summaries", "images", "salesRanks", "productTypes", "identifiers", "variations"];
//search EAN
$response = $catalogApi->searchCatalogItems([
'marketplaceIds' => [$marketplaceId],
'identifiersType' => 'EAN',
'identifiers' => [$ean],
'includedData' => $includedData
]);
// Visualizza la risposta
echo "<pre>";
print_r($response);
echo "</pre>";
} catch (Exception $e) {
// Gestisci gli errori
echo "Errore: ";
var_dump($e->getMessage());
}
but i receive this strange error:
SellingPartnerApiSellerCatalogItemsV20220401Api::getCatalogItem():
Argument #1 ($asin) must be of type string, array given
2
Answers
i have try to change the code as you suggest:
but now the error is:
Array to string conversion, ithink that something is wrong in the API
As per Amazon
searchCatalogItem
API call, theidentifiers
parameter is:Hence you will need change your code, in order to set the
identifiers
as a string (not as an array of strings). In case you need to ask for more than 1 EAN, just set that parameter with a comma-separated list of EAN codes.Warning: a maximum of 20 identifiers may be specified in the
identifiers
parameter.