abuzuhri / Amazon-SP-API-CSharp

.Net C# library for the new Amazon Selling Partner API
MIT License
217 stars 191 forks source link

Fixed confusing exception message for ParameterPatchListingItem #772

Closed prorena closed 1 month ago

prorena commented 1 month ago

Although the parameters are given as an Enum, Amazon expects them as string (see Amazon Listings Items):

{
  "productType":"LUGGAGE",
  "patches":[
    {
      "op":"replace",
      "path":"/attributes/item_name",
      "value":[
        {
          "value": "AmazonBasics 16\" Underseat Spinner Carry-On",
          "language_tag": "en_US",
          "marketplace_id": "ATVPDKIKX0DER"
        }
      ]
    },
...
}

The generated JSON-string converted the enum to an Integer:

Input code:

PatchOperation[] patches = new PatchOperation[1];

patches[0] = new PatchOperation()
{
   op = Op.replace,
   path = "/attributes/gpsr_safety_attestation",
   value = new object[] { true }
};

before: {"productType":"BRA","patches":[{"op":1,"path":"/attributes/gpsr_safety_attestation","value":[true]}]}

after: {"productType":"BRA","patches":[{"op":"replace","path":"/attributes/gpsr_safety_attestation","value":[true]}]}