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
580 stars 730 forks source link

Response from swagger client function is NOT a well formed JSON #1579

Closed ashokrajab closed 2 years ago

ashokrajab commented 3 years ago

The response obtained by invoking the swagger client function (for catalog api) is as follows:

code: catalogApi.getCatalogItemWithHttpInfo("endpoint", asin).getData().getPayload().toString() response: class Item { identifiers: class IdentifierType { marketplaceASIN: class ASINIdentifier { marketplaceId: ATVPDKIKX0DER ASIN: B00YT13T3Q } skUIdentifier: null } attributeSets: class AttributeSetList { [class AttributeSetListType { department: Unlocked cell phones are compatible with GSM carriers like AT&T and T-Mobile as well as with GSM SIM cards (e.g. H20, Straight Talk, and select prepaid carriers). Unlocked cell phones will not work with CDMA Carriers like Sprint, Verizon, Boost or Virgin. director: null displaySize: class DecimalWithUnits { value: 5 units: inches } itemDimensions: class DimensionType { height: class DecimalWithUnits { value: 0.34 units: inches } length: class DecimalWithUnits { value: 5.70 units: inches } width: class DecimalWithUnits { value: 2.84 units: inches } weight: class DecimalWithUnits { value: 0.343750 units: pounds } } isEligibleForTradeIn: true label: Samsung languages: null legalDisclaimer: null listPrice: class Price { amount: 159.99 currencyCode: USD } manufacturer: Samsung manufacturerPartsWarrantyDescription: null materialType: null maximumResolution: class DecimalWithUnits { value: null units: megapixels } model: Galaxy Grand Prime operatingSystem: [Android] opticalZoom: null packageDimensions: class DimensionType { height: class DecimalWithUnits { value: 1.99999999796 units: inches } length: class DecimalWithUnits { value: 5.99999999388 units: inches } width: class DecimalWithUnits { value: 3.49999999643 units: inches } weight: class DecimalWithUnits { value: 0.65036367290 units: pounds } } packageQuantity: 1 partNumber: G531H GLD productGroup: Wireless productTypeName: CELLULAR_PHONE smallImage: class Image { URL: https://m.media-amazon.com/images/I/51s-DOPdzwL._SL75_.jpg height: class DecimalWithUnits { value: 75 units: pixels } width: class DecimalWithUnits { value: 75 units: pixels } } studio: Samsung subscriptionLength: null systemMemorySize: class DecimalWithUnits { value: 8 units: GB } systemMemoryType: null theatricalReleaseDate: null title: Samsung Galaxy Grand Prime GSM Cellphone - Gold }] } relationships: class RelationshipList { [class RelationshipType { identifiers: class IdentifierType { marketplaceASIN: class ASINIdentifier { marketplaceId: ATVPDKIKX0DER ASIN: B00YVNVGXM } skUIdentifier: null } }] } salesRankings: class SalesRankList { [class SalesRankType { productCategoryId: ce_display_on_website rank: 101156 }, class SalesRankType { productCategoryId: 7072561011 rank: 3885 }] } }


The response obtained when invoking the catalog API via postman is as follows:

{ "payload": { "Identifiers": { "MarketplaceASIN": { "MarketplaceId": "ATVPDKIKX0DER", "ASIN": "B07SYHVWP8" } }, "AttributeSets": [ { "Binding": "Baby Product", "Brand": "Unknown", "Color": "Black", "Label": "Test", "Manufacturer": "Test", "ManufacturerMinimumAge": { "Units": "months", "value": 12.00 }, "PartNumber": "123213123", "ProductGroup": "Baby Product", "ProductTypeName": "BABY_PRODUCT", "Publisher": "Test", "SmallImage": { "URL": "https://m.media-amazon.com/images/I/11z7-R5VwML._SL75_.jpg", "Height": { "Units": "pixels", "value": 74 }, "Width": { "Units": "pixels", "value": 75 } }, "Studio": "Test", "Title": "Test (Black) - Test" } ], "Relationships": [ { "Identifiers": { "MarketplaceASIN": { "MarketplaceId": "ATVPDKIKX0DER", "ASIN": "B07SYZHM1M" } } } ], "SalesRankings": [] } }

As you can see the response obtained via directly invoking the API is a well-formed JSON whereas the one obtained via swagger client function is NOT a well-formed JSON (there is no , (comma) after each JSON element and strings like class RelationshipList are inserted in between).

Cleaning the response at our end is a tedious task. We are requesting the Amazon team to modify the definition of toString() function such that it returns a well-formed JSON.

If there are any work-arounds kindly suggest. We are willing to get it a shot.

Thanks, Ashok Developer Zoho Inventory

ashokrajab commented 3 years ago

Requesting assistance from Amazon Team. cc @rugved1991 @ShivikaK

github-actions[bot] commented 2 years ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.