amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
570 stars 730 forks source link

How to get the list item attributes property names as a human readable strings? #4115

Closed brunoamorimdev closed 2 weeks ago

brunoamorimdev commented 3 weeks ago

Hello,

I need to be able to get the attributes titles from the property name form to a human readable string. Are there any resources available to get this information from the API?

I assume it has a pattern because I does something similar to what I need in the Product Types Definitions API.

To ilustrate, I want to be able to get the names of the properties like this:

...
"attributes": {
    "total_hdmi_ports": [ // Get this property from "total_hdmi_ports" to, for example, "Total HDMI Ports"
      {
        "value": 4,
        "marketplace_id": "ATVPDKIKX0DER"
      }
    ],
    "resolution": [ // Or get this property from "resolution" to, for example, "Resolution"
      {
        "language_tag": "en_US",
        "value": "4K",
        "marketplace_id": "ATVPDKIKX0DER"
      }
    ],
}
...

The purpose is to extract this information as closely as possible to the information available by Amazon.

jawheral commented 2 weeks ago

Hi @brunoamorimdev,

You can take the ProductType for the Catalog item/Listing you are inspecting, fetch the relevant schema from the Product Types Definitions API and get the human readable string you need from the title property.

For example, for the TELEVISION product type:

Screenshot 2024-08-23 at 09 58 10

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

brunoamorimdev commented 2 weeks ago

Hi @brunoamorimdev,

You can take the ProductType for the Catalog item/Listing you are inspecting, fetch the relevant schema from the Product Types Definitions API and get the human readable string you need from the title property.

For example, for the TELEVISION product type: Screenshot 2024-08-23 at 09 58 10

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

Hi Jawher,

Thanks for the help!

Do you happend to have the documentation about this Use Case you showed me?

jawheral commented 2 weeks ago

Hi @brunoamorimdev,

We don't have a use case guide in the documentation for your specific use case. However, you can follow this Use Case Guide Tutorial on Product Type Definitions API in order to retrieve the JSON schema for your ProductType, schema documents can be retrieved programmatically with a standard HTTP client.

Once you retrieve the JSON schema, your can easily program logic to parse it and do the mapping using the attribute name and eventually identify the title for your attribute.

Note: I suggest this solution based on your ask of "extracting information as closely as possible to the information available by Amazon" so please keep the following in mind:

Best, Jawher Selling Partner API Solutions Architect

brunoamorimdev commented 2 weeks ago

Thank you @jawheral .

brunoamorimdev commented 2 weeks ago

Hi @brunoamorimdev,

You can take the ProductType for the Catalog item/Listing you are inspecting, fetch the relevant schema from the Product Types Definitions API and get the human readable string you need from the title property.

For example, for the TELEVISION product type: Screenshot 2024-08-23 at 09 58 10

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

Hey, @jawheral

One last thing, can you please provide a complete request example that returns this payload? Would really help to understand which endpoint and the response json we should expect from it. We are in a documentation oriented phase right now and since this Use Case is not documented, would be glad to have this information to continue our integrations.

jawheral commented 2 weeks ago

Hi @brunoamorimdev,

I can't provide a response example as it varies by different factors such as seller/vendor/marketplace. You need to be registered to call SP-API.

Please refer to this link in case you still didn't finish the registration process and learn more about authorization here.

Please navigate to this Product Type Definitions API operation. You will find the different parameters needed to call the api. You can also use the Swagger model available for this api to generate code or import in an api client.

Furthermore, check out the Selling Partner API Sandbox to receive static or dynamic responses for your testing and documentation phases.

Additionally, please refer to our videos on youtube. This video shows how the Product Type Definitions API is called (ignore the Listing API part if it doesn't apply to your use case for now).

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

brunoamorimdev commented 2 weeks ago

Hi @brunoamorimdev,

I can't provide a response example as it varies by different factors such as seller/vendor/marketplace. You need to be registered to call SP-API.

Please refer to this link in case you still didn't finish the registration process and learn more about authorization here.

Please navigate to this Product Type Definitions API operation. You will find the different parameters needed to call the api. You can also use the Swagger model available for this api to generate code or import in an api client.

Furthermore, check out the Selling Partner API Sandbox to receive static or dynamic responses for your testing and documentation phases.

Additionally, please refer to our videos on youtube. This video shows how the Product Type Definitions API is called (ignore the Listing API part if it doesn't apply to your use case for now).

I hope this helps!

Best, Jawher Selling Partner API Solutions Architect

This video helped a lot, just connected the dots on how to retrieve this information!

Thanks, @jawheral