Changes

Jump to navigation Jump to search
1,217 bytes added ,  11:56, 2 February 2017
Line 85: Line 85:  
=== JSON interface ===
 
=== JSON interface ===
 
=== Countries ===
 
=== Countries ===
You can either use the global (world) for locales (fr, en…)
+
You can either use the global (https://world.openfoodfacts.org) for locales (https://fr,https:// en…)
    
A few things to note:  
 
A few things to note:  
Line 91: Line 91:  
** https://fr.openfoodfacts.org/categorie/pizzas.json
 
** https://fr.openfoodfacts.org/categorie/pizzas.json
 
** an alternative is to specify the language in the subdomain: https://fr-en.openfoodfacts.org/category/pizzas.json
 
** an alternative is to specify the language in the subdomain: https://fr-en.openfoodfacts.org/category/pizzas.json
 +
 +
By default, the country code (cc) and language of the interface (lc) are set through the subdomain.
 +
e.g.
 +
1.1. https://world.openfoodfacts.org --> cc = world, lc = en (default language for the "country")
 +
1.2 https://fr.openfoodfacts.org --> cc = fr (France), lc = fr (French)
 +
1.3 https://jp.openfoodfacts.org --> cc = jp (Japan), lc = ja (Japanese)
 +
1.4 https://ch.openfoodfacts.org --> cc = ch (Switzerland), lc = de (German, set as main language for Switzerland)
 +
1.5 https://ch-fr.openfoodfacts.org --> cc = ch, lc = fr (French)
 +
 +
==== Over-riding country code and interface language using cc and lc parameters ====
 +
 +
If you pass ?cc=us and/or &lc=it, it will set the country to US and the language to Italian
 +
 +
-> if you just pass cc, the lc will be the one set in the subdomain.
 +
e.g. world.openfoodfacts.org + cc = fr --> cc = fr, lc = en (default language of world)
 +
 +
The cc affects which results are returned. cc = fr -> you get only products with France listed in the countries where sold field.
 +
 +
The lc affects the language in which results will come back.
 +
 +
If the results include links to products, those links will use a new subdomain that corresponds to the overrides.
    
=== Reading a product ===
 
=== Reading a product ===

Navigation menu