Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sample code in the README does not work, and the ->upload() helper seems to have issues under v7.1 #766

Open
misterakko opened this issue Aug 12, 2024 · 0 comments

Comments

@misterakko
Copy link

misterakko commented Aug 12, 2024

Problem description:

The sample code provided in the README file for feeds does not work anymore under v7 of the library.

Error:

Warning: Uncaught Error: Class "CreateFeedDocumentSpecification" not found

Code

 use SellingPartnerApi\Seller\FeedsV20210630\Dto\CreateFeedSpecification;
$feedType = 'POST_PRODUCT_PRICING_DATA';
$connector = SellingPartnerApi::seller(/* ... */);
$feedsApi = $connector->feedsV20210630();
// Create feed document
$contentType = CreateFeedDocumentResponse::getContentType($feedType);
$createFeedDoc = new CreateFeedDocumentSpecification($contentType);

I have rewritten the sample code in the hope of doing something useful for the community, but it looks like the FeedDocument::upload() helper method itself has issues now.

$feedType = 'JSON_LISTINGS_FEED';
   $feedContentType = 'application/json; charset=UTF-8';
   $feedsApi = $amazon->mySeller->FeedsV20210630();
   // Create feed document
   $createFeedDocSpec = new SellingPartnerApi\Seller\FeedsV20210630\Dto\CreateFeedDocumentSpecification($feedContentType);
   $createDocumentResponse = $feedsApi->createFeedDocument($createFeedDocSpec);
   $feedDocumentInfo = $createDocumentResponse->json();
   $feedDocument = $createDocumentResponse->dto();
try {
   $feedDocument->upload($feedType, $exportFile);
   }
catch (Exception $e) {
   echo "Error: " . $e->getResponse()->getBody()->getContents();
}

Returns:

Error: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId>AKIAX2ZVOZFBIPHKZ57H</AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20240812T084245Z
20240812/eu-west-1/s3/aws4_request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant