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

Processing PRODUCT_TYPE_DEFINITIONS_CHANGE notification #4526

Open
franclin opened this issue Jan 14, 2025 · 4 comments
Open

Processing PRODUCT_TYPE_DEFINITIONS_CHANGE notification #4526

franclin opened this issue Jan 14, 2025 · 4 comments
Assignees
Labels
listing Issues related to Listings API

Comments

@franclin
Copy link

I received a PRODUCT_TYPE_DEFINITIONS_CHANGE notification which looks like the example 2 in the documentation (https://developer-docs.amazon.com/sp-api/docs/notification-type-values#product_type_definitions_change)

How do I know which product type has just been updated? Knowing the new ProductTypeVersion surely wouldn't be of great help if I can't relate it to an actual product type. This has also been raised #4172 but no reply was given.

Here is the body of the notification just in case:

{
    "version": "0",
    "id": "978c3497-977f-1c10-d7ba-ca650188bb6a",
    "detail-type": "PRODUCT_TYPE_DEFINITIONS_CHANGE",
    "source": "aws.partner/sellingpartnerapi.amazon.com/xxx/amzn1.sp.solution.050aaa76-4b95-4c4b-xxx",
    "account": "xxx",
    "time": "2025-01-13T18:07:00Z",
    "region": "us-east-1",
    "resources": [],
    "detail": {
      "NotificationVersion": "1.0",
      "NotificationType": "PRODUCT_TYPE_DEFINITIONS_CHANGE",
      "PayloadVersion": "1.0",
      "EventTime": "2025-01-13T18:05:58.658744744Z",
      "Payload": {
        "AccountId": "xxx",
        "ProductTypeVersion": "UAAAAAAAAAAAAAAAAlYD0uo679EOIHE4wCD-2JHWu45Q="
      },
      "NotificationMetadata": {
        "NotificationId": "b83d8b80-4d07-4b54-8392-09e3d11ce5c7",
        "SubscriptionId": "78835ab5-1dcd-465c-a929-dabffbf2fcd0",
        "ApplicationId": "amzn1.sp.solution.050aaa76-4b95-4c4b-xxx",
        "PublishTime": "2025-01-13T18:05:58.658Z"
      }
    }
  }

Also is the ProductTypeVersion field unique to a given productType or the combination of the producttype and the marketplace ID?
Thanks

@weilinggu weilinggu self-assigned this Jan 14, 2025
@weilinggu weilinggu added the listing Issues related to Listings API label Jan 14, 2025
@weilinggu
Copy link
Contributor

Hi @franclin,

In the current design, once receiving the notification, developers need to fetch the product types they are interested in for the previous and new versions, and then do comparison to know the difference. (To know what the previous productTypeVersion version was, you would have to cache the old version somewhere).

The ProductTypeVersion field is not unique to a given productType or the combination of the product type and the marketplace ID. Instead, the ProductTypeVersion field represents the version of the overall product type definitions across all product types and marketplaces.

Alternatively, developers can utilize the monthly announcements such as this one to find major attribute and enum value updates.

Thanks
Weiling
Amazon Selling Partner Services

@franclin
Copy link
Author

Hi @weilinggu

Thanks for your reply. Still doesn't add up. When I run a getDefinitionsProductType operation I am seeing that they're 1810 product types currently available in the US marketplace. The reported product type version is: UAAAAAAAAAAAAAAAAlYD0uo679ELJJNiIgbSk98l7i3E=

When I requested the latest product types for 3 random product types (PRODUCT, WIG, and HOME), the reported product type is: UAAAAAAAAAAAAAAAAlYD0uo679ELJJNiIgbSk98l7i3E=

So it isn't clear to me which product types have UAAAAAAAAAAAAAAAAlYD0uo679EOIHE4wCD-2JHWu45Q= as the product type version.

Thanks for shedding some light into this issue.

Regards,
Franclin

@weilinggu
Copy link
Contributor

weilinggu commented Jan 15, 2025

@franclin

The ProductTypeVersion field represents the version of the overall product type definitions across ALL product types and marketplaces.

By the time you call the product type definition with LATEST, UAAAAAAAAAAAAAAAAlYD0uo679EOIHE4wCD-2JHWu45Q= likely is not the latest version anymore.

For example, you can use UAAAAAAAAAAAAAAAAlYD0uo679EOIHE4wCD-2JHWu45Q%3D (encoded value of the version string you provided) as value for parameter productTypeVersion, you should be able to get that specific version of product type definition for the product type you wish to retrieve.

In addition, you can take a look at John's response in this issue to get a better understanding of how version strings are released.

Alternatively, monthly announcements such as this one could be a good way to find major attribute and enum value updates.

Thanks
Weiling
Amazon Selling Partner Services

@franclin
Copy link
Author

Thanks for your reply @weilinggu

I ran the getDefinitionsProductType operation straight after receiving the notification. I thought the whole point of the notification was to inform us about the latest version of the product type version.

So if I understand correctly it means that we really shouldn't rely on the product type version reported in the notification and that we're not guaranteed to receive a notification if there is an updated product type available.

In this case, it would mean that there is no guarantee that there will be a notification reporting UAAAAAAAAAAAAAAAAlYD0uo679ELJJNiIgbSk98l7i3E= as the version.

So whenever we receive the PRODUCT_TYPE_DEFINITIONS_CHANGE notification, we should just manually check all the product types available (which at the moment there're 1810 of them available in the US marketplace)

Also you mentioned about the monthly announcements, is it possible to leverage those programmatically? Seems to me like it will be a manual process.

Does it make sense?

Thanks,
Franclin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
listing Issues related to Listings API
Projects
None yet
Development

No branches or pull requests

2 participants