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
612 stars 737 forks source link

[BUG] getCatalogItem return double quote error #2190

Closed littleylv closed 2 years ago

littleylv commented 2 years ago

Describe the bug when the item_name contains ", getCatalogItem return with \" for example: https://www.amazon.co.uk/dp/B075LN87WY here it shows KATUR 3/4" Round LED Front..., but getCatalogItem returns:

[language_tag] => en_GB
[value] => KATUR 3/4\" Round LED Front...
[marketplace_id] => A1F83G8C2ARO7P

same problem to generic_keyword, product_description, bullet_point

URL of the content on GitHub Please provide the GitHub URL for the documentation where you see the bug.

chapmanjw commented 2 years ago

Both item_name in the attributes and itemName in the summaries sections are correctly encoded for JSON:

{
  "asin": "B075LN87WY",
  "attributes": {
    "item_name": [
      {
        "language_tag": "en_GB",
        "value": "KATUR 3/4\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)",
        "marketplace_id": "A1F83G8C2ARO7P"
      }
    ]
  },
  "summaries": [
    {
      "marketplaceId": "A1F83G8C2ARO7P",
      "brandName": "KATUR",
      "browseNode": "303682031",
      "itemName": "KATUR 3/4\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)",
      "manufacturer": "KaTur",
      "modelNumber": "10",
      "sizeName": "10pcs Amber"
    }
  ]
}

Without the \ in front of the double-quote, the JSON would be invalid.

How are you parsing/consuming the attributes data? It's likely that something isn't decoding the string correctly.

littleylv commented 2 years ago

@chapmanjw But my json string (\\\") is not like yours (\"):


        "item_name":[
            {
                "language_tag":"en_GB",
                "value":"KATUR 3/4\\\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)",
                "marketplace_id":"A1F83G8C2ARO7P"
            }
        ],

and i am using PHP json_decode to parse it:

[item_name] => Array
                (
                    [0] => Array
                        (
                            [language_tag] => en_GB
                            [value] => KATUR 3/4\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)
                            [marketplace_id] => A1F83G8C2ARO7P
                        )

                )

I try the same PHP code to call different api: when calling the v0 api, the Title is correct:

"Title": "KATUR 3/4\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)"

but the 2020-12-01 api returns:

"itemName":"KATUR 3/4\\\" Round LED Front Rear Side Marker Indicators Light Waterproof Bullet Clearance Marker Light 12V for Car Truck (Amber)"
chapmanjw commented 2 years ago

@littleylv I can confirm what you are seeing. There is a component in between our backend systems and external clients that is transforming this result incorrectly. I will update this issue once we have a path forward for fixing it. Thanks!

chapmanjw commented 2 years ago

@littleylv Thanks for alerting us to this issue. We have a fix in the works that should be deployed by Monday. I will post another update here once the fix has been deployed.

chapmanjw commented 2 years ago

@littleylv The fix for this has been deployed.

littleylv commented 2 years ago

@chapmanjw Thank you very much! 👍 I have conformed that works now.