A product has codes, texts and pictures. The texts and pictures can be defined for multiple languages. For each product a set of complement products can also be defined.
Note that all used languageCodes must be registered on the account used to upload the information to Mediablob. Please check your account details with your Shoppa representative if you are unsure.
Lets build a product from scratch and see how different requiements evolve its xml definition.
A basic product
Lets say our customerId is 1143 and we have a product with only some basic information:
A product must always have at least one text section. Brand and name are required for new products. In the example above the product is described in the Swedish language.
Extending the product information
We extend the product with additional sales arguments and a unit for prices:
short sales argument: Exklusivt tvåpack. En perfekt bröllopspresent.
long sales argument: Efva Attling är en juveldesigner som har använt sin rika erfarenhet och expertis för att skapa glaskonst. Hennes tredje glas är ett maskulint martiniglas med en silverring.
unit: st
The xml for describing the product now becomes:
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
<products>
<product id="65467-14" idType="Code1">
<codes>
<code name="EAN13" value="123456789012" />
</codes>
<texts>
<text productName="Champagne glass" brand="Orrefors" languageCode="sv-SE">
<field name="sashort">Exklusivt tvåpack & en perfekt bröllopspresent.</field>
<field name="salong">Efva Attling är en juveldesigner som har använt sin rika erfarenhet och expertis för att skapa glaskonst. Hennes tredje glas är ett maskulint martiniglas med en silverring.</field>
<field name="unit">st</field>
</text>
</texts>
</product>
</products>
</mediablob>
To protect content against xml formatting constraints, the & character is xml encoded. This follows the xml specification and must be used for any content.
Additional languages
We decide to support English too. The xml gets extended with an additional <text /> section. We also start the product with a generic language text xx with generic text for all languages unless overridden.
Even without actual such texts, we recommend always including a row for xx to prevent duplicate products in the future.
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
<products>
<product id="65467-14" idType="Code1">
<codes>
<code name="EAN13" value="123456789012" />
</codes>
<texts>
<text productName="Champagne glass" brand="Orrefors" languageCode="xx"></text>
<text productName="Champagne glas" languageCode="sv-SE">
<field name="sashort">Exklusivt tvåpack & en perfekt bröllopspresent.</field>
<field name="salong">Efva Attling är en juveldesigner som har använt sin rika erfarenhet och expertis för att skapa glaskonst. Hennes tredje glas är ett maskulint martiniglas med en silverring.</field>
<field name="unit">st</field>
</text>
<text productName="Champagne glass" languageCode="en-GB">
<field name="sashort">Exclusive Twin-pack & the perfect wedding present.</field>
<field name="salong">Efva Attling is a designer of jewellery who has now brought her considerable experience and skills to the creation of glass. The third glass of the collection is a more masculine martini glass whose silver ring, though slightly sterner than its cousins, expresses the same warm sentiments.</field>
<field name="unit">item</field>
</text>
</texts>
</product>
</products>
</mediablob>
Picture support
Finally, we add pictures to the swedish brand and productName fields. English users do not get to see any pictures for now.
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
<products>
<product id="65467-14" idType="Code1">
<codes>
<code name="EAN13" value="123456789012" />
</codes>
<texts>
<text productName="Champagne glass" brand="Orrefors" languageCode="xx"></text>
<text productName="Champagne glass" brand="Orrefors" languageCode="sv-SE">
<field name="sashort">Exklusivt tvåpack & en perfekt bröllopspresent.</field>
<field name="salong">Efva Attling är en juveldesigner som har använt sin rika erfarenhet och expertis för att skapa glaskonst. Hennes tredje glas är ett maskulint martiniglas med en silverring.</field>
<field name="unit">st</field>
</text>
<text productName="Champagne glass" brand="Orrefors" languageCode="en-GB">
<field name="sashort">Exclusive Twin-pack & the perfect wedding present.</field>
<field name="salong">Efva Attling is a designer of jewellery who has now brought her considerable experience and skills to the creation of glass. The third glass of the collection is a more masculine martini glass whose silver ring, though slightly sterner than its cousins, expresses the same warm sentiments.</field>
<field name="unit">item</field>
</text>
</texts>
<pictures>
<picture countryCode="se" languageCode="sv-SE" fieldName="brand" hashCode="a18deaa4383718cefc1a643f49e37607" />
<picture countryCode="se" languageCode="sv-SE" fieldName="productName" hashCode="4b70b9000951a15db2ba6e61f05c3158" />
</pictures>
</product>
</products>
</mediablob>
As you can see, the pictures are referenced by a hashCode. What hashCode to use will be described in detail in the Pictures section.
Pictures require a countryCode. This is a legacy construct and is easily created by lowercasing the last two characters of the languageCode.
Reference a picture by its md5 hash
The hashCode returned from the picture uploader is based on md5, but formatted as a guid. The difference is big or little endianess. If you prefer to reference the picture by its md5 code, you can use the md5 attribute instead:
Instead of referencing an image by hashCode or md5, you can provide a public uri from where Mediablob can download the picture for you. Mediablob will only use the same uri once, so you must ensure the uri is unique for each picture. Avoid using this scheme unless you are using a picture database that ensure unique uri's per picture.