Internal only.


FAQ created after this trello work was done - https://trello.com/c/ifxoq5mk/2768-trundles-product-id-issue


How Trademe product upload works


We have to upload the product data in this order:


  1. The images: all images for all products and variants
  2. The Product: one Omnivore variant makes one Trademe Product
  3. The Listing Rule: one Omnivore variant also makes one Trademe Listing Rule


Any of these steps might fail.

The errors displayed in Omnivore are not necessarily in the order they occur.


The Upload Context and the Debug: upload buttons


We store what we have uploaded in the Upload Context, so that next time we don't upload data that has not changed (aka delta logic).

This helps Trademe not being overloaded with Omnivore requests, but on occasions it causes issue on our side.


There are now 2 buttons to debug upload in the admin section at the bottom of the product page:

1. Debug: upload product - does the same as the regular code used in the upload jobs, ie it accounts for the upload context.

2. Debug: force upload product - it ignores the upload context and uploads all the data again. You get the same effect if you delete the upload context and then to Debug: upload product.


The errors


This fragment of the error message:

"listing: 400 TradeMeListingRule.ProductID has not been supplied"

means:

When called the Trademe api that creates the Listing aka Listing Rule aka TradeMeListingRule, we got back the error message:

"TradeMeListingRule.ProductID has not been supplied".

As written in this ticket https://citybeachsoftware.freshdesk.com/a/tickets/160013

this means we tried to create a Listing Rule for a product that does not exist.

The product does not exist because when we called the api to create the product it also returned an error.


In some cases the error relates to the account, eg:

"The limit on the maximum number of products has been met"


Or the product, eg:

"Product.Brand cannot have more than 70 characters"


In other cases, eg: " ... Please upload photos before assigning them to products"

it's because the Photo upload failed, then the Product api call references the photo that has failed thus it does not exist in Trademe.

If so, in Omnivore it shows an error like:

"... Error downloading photo at ..."

"... does not appear to be an image ..." (webp images are not accepted by Trademe)

"...  is not in the correct format e.g. http://www.somesite.com/image/123.jpg  or ftp://username:password@ftp.somesite.com/image/image.jpg ..."


In all cases the action is to:


  1. Skip over the first part of the error
  2. Fix the actual error, found in the second part of the error


What if there's no "second part"?


Try the Debug: force upload product button. If that works, problem solved.

If that doesn't work, look for this:


In chat with Chris Andrews from Trademe we found that Trademe has a limit of 50 characters for the product code. We do not validate that, ie we send up whatever value is in the marketplace product variant sku, aka marketplace sku.

If the value is longer than the 50 chars limit, Trademe doesn't fail the upload, instead it creates a different product code, effectively creating a product that we do not know about or control. 

Example here:

https://m6.omnivore.com.au/product/view?retailerCode=angelique&sku=2239


request url = https://api.tradevine.com/v1/Product, payload = {    

"Code": "2239-4421::15192~4422::15197~STM10672x-Fuchsia-1x2x",    

"Name": "Plunging Lace Halter Babydoll 1x/2x-Fuchsia",


response statusLine = HTTP/1.1 200 OK, pretty body = {    

"ProductID": 3892545359463517819,    

"OrganisationID": 3720436015828214654,    

"Code": "PR73876",    

"Name": "Plunging Lace Halter Babydoll 1x/2x-Fuchsia",


So then the listing rule upload fails:

request url = https://api.tradevine.com/v1/TradeMeListingRule, payload = {    "ExternalTradeMeOrganisationName": "angelique_inc",    

"ProductCode": "2239-4421::15192~4422::15197~STM10672x-Fuchsia-1x2x",


response statusLine = HTTP/1.1 400 Bad Request, body = TradeMeListingRule.ProductID has not been supplied


The fix would be to not use marketplace skus longer than 50 chars.


Ideas for improving the integration


  • Validate and restrict the sku length (fixes the error above)
  • Validate and restrict Brand length (see error above)
  • Do not use in Product and Listing Rule images that failed - done
  • Do not upload Listing Rule if the Product failed
  • Manage validation errors at the variant level not at the product level in Omnivore, so that one single failed variant will not make the whole product fail
  • Automatically convert and upscale images when required




~