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

Parsing ProductTypes #767

Open
franclin opened this issue Aug 14, 2024 · 13 comments
Open

Parsing ProductTypes #767

franclin opened this issue Aug 14, 2024 · 13 comments

Comments

@franclin
Copy link

Is it possible with this SDK to parse the productTypes returned by the getDefinitionsProductType operation?

@misterakko
Copy link

misterakko commented Aug 14, 2024

What do you need parsing? If $amazon->seller is what you got from calling SellingPartnerApi::seller() and $MARKETPLACE_ID is the code of the website where your merchandise is listed (e.g. Amazon Germany) then you do this

$ptdApi = $amazon->seller->ProductTypeDefinitionsV20200901();
$info = $ptdApi->getDefinitionsProductType (productType:'MEDICATION', marketplaceIds:[$MARKETPLACE_ID])->json();

$info is an array with two interesting things: (a) $info['schema']['link'] points to a JSON Schema file which describes what files you must send to offer your products in that marketplace (b) $info['propertyGroups'] lists by name all fields that Amazon will accept when describing the product.

@franclin
Copy link
Author

What do you need parsing? If $amazon->seller is what you got from calling SellingPartnerApi::seller() and $MARKETPLACE_ID is the code of the website where your merchandice is listed (e.g. Amazon Germany) then you do this

$ptdApi = $amazon->seller->ProductTypeDefinitionsV20200901();
$info = $ptdApi->getDefinitionsProductType (productType:'MEDICATION', marketplaceIds:[$MARKETPLACE_ID])->json();

$info is an array with two interesting things: (a) $info['schema']['link'] points to a JSON Schema file which describes what files you must send to offer your products in that marketplace (b) $info['propertyGroups'] lists by name all fields that Amazon will accept when describing the product.

Hello @misterakko

Essentially I am looking for an implementation like this one: https://developer-docs.amazon.com/sp-api/docs/product-type-definition-meta-schema-v1-example-javascript in PHP.

Product Types are meant to be parsed to show required and optional fields that are to be provided in the JSON LISTING feed.

@misterakko
Copy link

Ah, OK, now I understand. Yes, that would be useful. No, the library does not do anything like that, AFAIK. For context, see the author's note at #710

I have looked a bit into your problem — I'm trying to wrap my head around the absolute clusterfuck that is Amazon's move to JSON, and I guess you are doing the same.
It seems to me that the JSON schema format is documented here: https://json-schema.org/draft/2019-09/release-notes
If I'm right, than a PHP alternative to your JavaScript tool could be located here https://json-schema.org/implementations

If you find something promising, please leave a line here, I guess that could be useful to many.

@franclin
Copy link
Author

Ah, OK, now I understand. Yes, that would be useful. No, the library does not do anything like that, AFAIK. For context, see the author's note at #710

I have looked a bit into your problem — I'm trying to wrap my head around the absolute clusterfuck that is Amazon's move to JSON, and I guess you are doing the same. It seems to me that the JSON schema format is documented here: https://json-schema.org/draft/2019-09/release-notes If I'm right, than a PHP alternative to your JavaScript tool could be located here https://json-schema.org/implementations

If you find something promising, please leave a line here, I guess that could be useful to many.

Great that you got my point. Indeed it stems from migrating from XML to JSON feeds. You are correct in your assessment that it seems to be a clusterfuck process overall.

The JSON schema implementation that you pointed out is not fit for purpose when it comes to Amazon Schema, looks like the only way to deal with it is to move another language where it is supported.

You are right to mention in Issue #710 that the new listing process seems like a rewrite of the Seller Central and seems to favour listing items 1x1 so scaling this approach to million items will be a nightmare.

So I am also looking for ways to overcome that challenge. One thing is for sure this library in its current form isn't the answer as far as I can tell.

@jlevers
Copy link
Owner

jlevers commented Aug 15, 2024

Depending on the feed type, I'm working on a (paid) tool that will allow you to input the old feeds and get out the proper JSON format for the new ones – an initial version should be ready in the next couple weeks.

@franclin
Copy link
Author

Depending on the feed type, I'm working on a (paid) tool that will allow you to input the old feeds and get out the proper JSON format for the new ones – an initial version should be ready in the next couple weeks.

Thanks @jlevers looking forward to seeing it.
Converting old XML feeds to their JSON versions isn't too difficult by the look of it.

What seems to be more intricate is the process of listing new items and including the correct data. This requires parsing complex JSON schemas and also it is unclear how this approach can scale.

@jlevers
Copy link
Owner

jlevers commented Aug 16, 2024

I've written a basic tool for that second part as well – I'll figure out a way to release it sometime soon. I don't think it's realistically possible to automate listing products of an arbitrary product type, because you need to know what information is required before you start the listing process, but I have a two-step process that parses the JSON schema and then generates a templated JSON file with all the attributes that need to be filled out.

@franclin
Copy link
Author

Ok great looking forward to seeing it.

@jlevers
Copy link
Owner

jlevers commented Sep 10, 2024

@franclin the feed converter is now available, here: https://tools.highsidelabs.co

Hoping to have the product type schema parsing live in the next few weeks.

@misterakko
Copy link

I see no mention of POST_ORDER_FULFILLMENT_DATA in that page, should I worry?

@jlevers
Copy link
Owner

jlevers commented Sep 10, 2024

That feed type isn't being deprecated :) so you can keep using it as is

@franclin
Copy link
Author

Thanks @jlevers will have a look at that.

By the way, I don't think that order related XML feeds are being deprecreated as per Deprecations.

The POST_ORDER_FULFILLMENT_DATA feed is very important to the order processing workflow. It is used to automatically flag an order as being shipped.

Thanks

@jlevers
Copy link
Owner

jlevers commented Sep 10, 2024

Yep, that's right – it's just the listing-related feeds that are being deprecated.

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

3 participants