double-break / spapi-php

Amazon Selling Partner API PHP Client
MIT License
56 stars 48 forks source link

Feed API 2021-06-30 update is a major breaking change #38

Closed Alanaktion closed 2 years ago

Alanaktion commented 3 years ago

It is worth noting that the change in 7edc890 (v1.0.11) is a major breaking change that completely replaces the Feed API interaction. The change from 2020-09-04 to 2021-06-30 affects a lot of the behavior and is not a drop-in replacement. The reference usage in the README is no longer accurate after this update, and it broke our integrations.

I'd recommend making it an opt-in replacement under a new Feeds202106 class or something like that, or at least introducing it as a new minor/major version rather than a patch release, as it definitely breaks any integrations relying on it.

aniruddhaad commented 3 years ago

Specifically the 2 changes I noticed was

  1. with the version "2020-09-04" createFeedDocument was suppose to return the encryptionDetails in the response however with "2021-06-30" it does not return encryptionDetails params as per the documentation at URL- https://github.com/amzn/selling-partner-api-docs/blob/8438231aefe8dfbdf7c1758ddf137a0c728bb21b/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide-2020-09-04.md

This also brakes feed upload completely.

  1. in the response array ['payload'] array was removed and the response was directly added to main array. This brakes few more things.
ccarnivore commented 3 years ago

I'm facing an issue with Feed-API Version 2021-06-30. Has anyone already got the version running?

Creating the feed document and uploading the (in my case) xml file went well i guess. But when I'm trying to create the feed itself I'm getting different errors;

POST /feeds/2021-06-30/feeds HTTP/1.1
{
"feedType":"POST_INVENTORY_AVAILABILITY_DATA",
"inputFeedDocumentId":"amzn1.tortuga.3.9d2c55ee-0f34-41c2-86c3-6a196c261867.XXXXXXX",
"marketplaceIds":"A1PA6795UKMFR9"
}

results in

{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "One or more required parameters missing",
      "details": "marketplaceIds;"
    }
  ]
}

when I try to submit the marketplaceIds as an array like this

{
"feedType":"POST_INVENTORY_AVAILABILITY_DATA",
"inputFeedDocumentId":"amzn1.tortuga.3.a6e76ea4-2d64-4f2e-9bb1-809f7ee22508.XXXXXXX",
"marketplaceIds":["A1PA6795UKMFR9"]
}

my request fails with the following error:

{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "Invalid request parameters",
      "details": ""
    }
  ]
}

has anybody an idea?

aniruddhaad commented 3 years ago

I would suggest you to try it with 2020-09-04 version first. Check if that works.

ccarnivore commented 3 years ago

Got exact the same response.

$response = $feedService->createFeed([
    'feedType' => $feedType,
    'marketplaceIds' => 'A1PA6795UKMFR9',
    'inputFeedDocumentId' => $documentId
]);

> POST /feeds/2020-09-04/feeds HTTP/1.1
{"feedType":"POST_INVENTORY_AVAILABILITY_DATA","inputFeedDocumentId":"amzn1.tortuga.3.83dd421e-7363-47b4-aabf-23a8c96f848a.XXXXXXXX","marketplaceIds":"A1PA6795UKMFR9"}

//RESPONSE
{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "One or more required parameters missing",
      "details": "marketplaceIds;"
    }
  ]
}

or

$response = $feedService->createFeed([
    'feedType' => $feedType,
    'marketplaceIds' => ['A1PA6795UKMFR9'],
    'inputFeedDocumentId' => $documentId
]);

> POST /feeds/2020-09-04/feeds HTTP/1.1
{"feedType":"POST_INVENTORY_AVAILABILITY_DATA","inputFeedDocumentId":"amzn1.tortuga.3.c384011f-3b19-40ee-9e8a-d266d9cb2e36.XXXXXXXX","marketplaceIds":["A1PA6795UKMFR9"]}
{
  "errors": [
    {
      "code": "InvalidInput",
      "message": "Invalid request parameters",
      "details": ""
    }
  ]
}
lyubo-slavilov commented 2 years ago

It is worth noting that the change in 7edc890 (v1.0.11) is a major breaking change that completely replaces the Feed API interaction. The change from 2020-09-04 to 2021-06-30 affects a lot of the behavior and is not a drop-in replacement. The reference usage in the README is no longer accurate after this update, and it broke our integrations.

I'd recommend making it an opt-in replacement under a new Feeds202106 class or something like that, or at least introducing it as a new minor/major version rather than a patch release, as it definitely breaks any integrations relying on it.

Sorry about that. I am updating this as I go. I cant keep track of every change the Amazon introduces to their API, and how they break previous version. Your PRs are more than welcome.

lyubo-slavilov commented 2 years ago

You always can create your custom clients, you know? Example to older version of CatalogItems


class CatalogV0 extends DoubleBreak\Spapi\Client {

    public function listCatalogItems(array $query = []) {
        return $this->send("/catalog/v0/items", [
          'method' => 'GET',
          'query' => $query,
        ]);
    }

}

...
$myClient = new CatalogV0($cred, $config);

...