This example provides a set of four ShopDates as response.
[{ type:ShopDate, version: 1, data:[ [0, 0, 2010-06-15, 25, 2010-06-13T10:00:00+0200, 5, alles normal], [0, 0, 2010-06-22, 26, 2010-06-20T10:00:00+0200, 5, alles normal], [0, 0, 2010-06-29, 27, 2010-06-27T10:00:00+0200, 5, alles normal], [0, 0, 2010-07-06, 28, 2010-07-04T10:00:00+0200, 5, alles normal], [0] ] }, ...more types are possible here... ]
The response is always wrapped into an array – as often several objects are returned.
This can be represented as BNF:
list-of-types := "[" type [, type] "]" type := "{type:" typename " [,"version": version] [,"cnt": cnt] ,data:" data "}" version := <number> cnt := <number> data := "[" record [, record,] "[0] ]" record := <any complete JSON structure>
The response is essentially a array of types, each containing only the values.
cnt may provide the number of records in the data element.
version is optional and can be used to handle version differences on the client side. You’ll find version notes at the object documentation.
The data section is always finished with a final [0] array element. The inner list of objects is parsed as array by some parsers. It does not matter usually, because the logical structure is the same. Be careful, there is a danger of misaligning values when parsing these data rows, as there are sometimes many values [1].
Example# #
This is the result of a query for items in rubric „11“ of Shop „bosshamerschhof“ (try it!):
http://oekobox-online.de/v3/shop/bosshamerschhof/rubric/11
[{"type":"Item", "data":[ [3100,"Jagdwurst 160g Glas",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], [3101,"Leberwurst Schwein 160g Gla",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], [3102,"Mettwurst Schwein 160g Glas",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], [3103,"Zwiebelwurst 160g Glas",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], [3000,"Bratwürstchen 4 St. 250g",4.79,"Stück","",8,7.00,1,0,"S",0,"1.92€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3001,"Bratwürstchen klein 12St. 250g",4.79,"Stück","",8,7.00,1,0,"S",0,"1.92€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3003,"Wiener Bioland 5 St. 200g",3.99,"Stück","",8,7.00,1,0,"S",0,"2.00€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3004,"Edel-Salami 160g",4.99,"Stück","",8,7.00,1,0,"S",0,"4.99€/St.",0,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3020,"Pfefferbeißer 7 St. 140g",3.29,"Stück","",8,7.00,1,0,"S",0,"2.06€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3027,"Schwarzwälder Schinken 80g",4.49,"Stück","",8,7.00,1,0,"S",0,"4.49€/St.",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-13], [3045,"Bio-Premium Schinken luftg 80g",4.99,"Stück","",8,7.00,1,0,"S",0,"15.12€/St.",1,1,0,0,"31.03.2013",1,1,1,1,0,0,1,-13], [3085,"Räucherlinge (8 * 20g)",3.79,"Stück","Bioladen",265,7.00,1,0,"S",0,"2.37€/100 g",1,1,0,0,"31.03.2013",1,1,1,0,0,0,1,-13], [3031,"Dörrfleisch ca. 100g",25.90,"kg","",8,7.00,1,0,"W",0,"3.24€/Stück",0,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-11], [3017,"Fleischwurst 200g",3.49,"Stück","",8,7.00,1,0,"S",0,"1.74€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,1,-13], [0]] }, {"type":"XUnit", "data":[ [3000,"Stück",1.00,"S,3"], [0]] }]
Wrapping into a variable (JSON-P)# #
Some methods support the wrapping of the response into a variable. This behavior is triggered by the request parameter var=<varname>. The result will loo like this:
http://oekobox-online.de/v3/shop/bosshamerschhof/rubric/11?var=xyz
var xyz = {"type":"Item", "data":[ [3100,"Jagdwurst 160g Glas",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], [3101,"Leberwurst Schwein 160g Gla",2.69,"Glas","",8,7.00,1,0,"S",0,"1.68€/100 g",1,1,0,0,"31.03.2013",1,1,1,1,0,0,0,-112], .... ]
This is especially convenient, if the data is fetched as part of the such a script call, to overcome the same-origin limitation.
<script type="text/javascript" src="http://oekobox-online.de/v3/shop/schoenegge/itemlist?i=882,9701&var=xyz"></script>