Difference between pages "Global packaging taxonomy" and "API"

From Open Food Facts wiki
(Difference between pages)
Jump to navigation Jump to search
m
 
(Update TODO)
 
Line 1: Line 1:
<<back to [[Global taxonomies]]
+
== TODO ==
 +
* <strike>Translate the data page (http://fr.openfoodfacts.org/data) in English</strike> and make it available on all subdomains
 +
* Document all current API
 +
* Write further API specifications
  
source:https://en.wikipedia.org/wiki/Recycling_codes
+
== API Basic Documentation ==
<pre>
+
=== Reading a product ===
 +
See http://fr.openfoodfacts.org/data or http://en.openfoodfacts.org/data
  
synonyms:en:Recycling code, RC
 
  
en:Recycled material
+
=== Searching for products ===
fr:Matériau recyclé
 
  
<en:Recycled material
+
You can add &jqm=1 to search results pages on the web site to get results in a jquerymobile format.
en:Recycled plastic
 
fr:Plastique recyclé
 
  
# note: en: synonyms (E.g. RC codes) apply to all languages, there is no need to repeat them
+
e.g. http://world.openfoodfacts.org/cgi/search.pl?search_terms=coke&search_simple=1&jqm=1
en:PET, Recycling Code 1, RC 01, 1, 01, PET, ,PET(E), PETE, Polyethylene terephthalate
 
fr:Polytéréphtalate d'éthylène, polyéthylène téréphtalate
 
  
<en:PET
+
=== Posting photos ===
<en:Recycled Plastic
+
* Photos post on /cgi/product_image_upload.pl
en:Recycled PET, rPET
+
:code: the barcode
image:01-PET.100x100.svg
+
:imagefield: "front"
 +
:imgupload_front : your image file
  
en: #2 PEHD,HDPE,High-density polyethylene
+
=== Posting a new product ===
fr:Polyéthylène haute densité, polyéthylène haute-densité
+
* Product post to http://fr.openfoodfacts.org/cgi/product_jqm2.pl
image:02-PE-HD.100x100.svg
 
  
en: #3 PVC,Polyvinyl chloride
+
:var foodfact = { barcode : '3073780969000', name : 'KIRI GOUTER 280G 8 PORTIONS', energy: 500, energy_unit: "kJ", weight: 282 };
fr:Polychlorure de vinyle, chlorure de polyvinyle
+
:var postData = {
image:03-PVC.100x100.svg
+
:code        : foodfact.barcode,
 
+
:user_id      : "mesinfosnutritionelles",
en: #4 PELD,LDPE,Low-density polyethylene
+
:password    : "****",
fr:Polyéthylène basse densité, polyéthylène basse-densité
+
:product_name : foodfact.name?foodfact.name:foodfact.shop_label,
image:04-PE-LD.100x100.svg
+
:quantity    : foodfact.weight?""+foodfact.weight+" g":undefined,
 
+
:stores      : "Intermarché",
en: #5 PP,Polypropylene
+
:nutriment_energy      :foodfact.energy,
fr:Polypropylène, polypropène
+
:nutriment_energy_unit :foodfact.energy_unit,
image:05-PP.100x100.svg
+
:nutrition_data_per    :"serving"
 
+
:{"status_verbose":"fields saved","status":1}
en: #6 PS,Polystyrene
+
* code=3073780969000&user_id=usernameexample&password=*****&product_name=KIRI%20GOUTER%20280G%208%20PORTIONS&quantity=282%20g&stores=Intermarch%C3%A9&nutriment_energy=500&nutriment_energy_unit=kJ&nutrition_data_per=serving
fr:Polystyrène
 
image:06-PS.100x100.svg
 
 
 
en: #7 O (OTHER),All other plastics
 
fr:Autres plastiques
 
image:07-O.100x100.svg
 
 
 
en: #9,#ABS,Acrylonitrile butadiene styrene
 
fr:Acrylonitrile butadiène styrène
 
image:ABS.100x100.svg
 
 
 
en: #8 Lead,Lead–acid battery
 
image:
 
 
 
en: #9,#19 Alkaline,Alkaline battery
 
fr:Pile alcaline, batterie alcaline, accumulateur alcaline
 
image:
 
 
 
en: #10 NiCD,Nickel–cadmium battery
 
fr:Accumulateur nickel-cadmium, batterie nickel-cadmium
 
image:
 
 
 
en: #11 NiMH,Nickel–metal hydride battery
 
fr:Accumulateur nickel-hydrure métallique, batterie nickel-hydrure métallique
 
image:
 
 
 
en: #12 Li,Lithium battery
 
fr:Accumulateur lithium, batterie lithium, batterie au lithium, accumulateur au lithium
 
image:
 
 
 
en: #13 SO(Z),Silver-oxide battery
 
image:
 
 
 
en: #14 CZ,Zinc–carbon battery
 
image:
 
 
 
en: #20 C PAP (PCB),Cardboard
 
fr:Carton, carton ondulé
 
image:20-PAP.100x100.svg
 
 
 
en: #21 PAP,Other paper
 
fr:Autres papiers, autre papier
 
image:21-PAP.100x100.svg
 
 
 
en: #22 PAP,Paper
 
fr:Papier
 
image:22-PAP.100x100.svg
 
 
 
en: #23 PBD (PPB),Paperboard
 
fr:Papier cartonné
 
image:
 
 
 
en: #40 FE,Steel
 
fr:Acier
 
image:40-FE.100x100.svg
 
 
 
en: #41 ALU,Aluminium
 
image:
 
 
 
en: #50 FOR,Wood
 
fr:Bois
 
image:50-FOR.100x100.svg
 
 
 
en: #51 FOR,Cork
 
fr:Liège
 
image:51-FOR.100x100.svg
 
 
 
en: #60 COT,Cotton
 
fr:Coton
 
image:60-TEX.100x100.svg
 
 
 
en: #61 TEX,Jute
 
image:61-TEX.100x100.svg
 
 
 
en: #62-69 TEX,Other Textiles
 
fr:Autres textiles, autre textile
 
image:
 
 
 
en: #70 GLS,Mixed Glass Container/Multi-Part Container
 
image:70-GL.100x100.svg
 
 
 
en: #71 GLS,Clear Glass
 
image:71-GL.100x100.svg
 
 
 
en: #72 GLS,Green Glass
 
image:72-GL.100x100.svg
 
 
 
en: #73 GLS,Dark Sort Glass
 
image:
 
 
 
en: #74 GLS,Light Sort Glass
 
image:
 
 
 
en: #75 GLS,Light Leaded Glass
 
image:
 
 
 
en: #76 GLS,Leaded Glass
 
image:
 
 
 
en: #77 GLS,Copper Mixed/Copper Backed Glass
 
image:
 
 
 
en: #78 GLS,Silver Mixed/Silver Backed Glass
 
image:
 
 
 
en: #79 GLS,Gold Mixed/Gold Backed Glass
 
image:
 
 
 
en: #81 PapPet,Paper + plastic
 
image:
 
 
 
en: #84 C/PAP,PapAl,Paper and cardboard / Plastic / Aluminium
 
image:84-C-PAP.100x100.svg
 
 
 
en: #87 Card-stock Laminate,Biodegradable plastic
 
image:
 
</pre>
 
 
 
 
 
<pre>
 
プラ.100x100.svg
 
紙-707x704.svg
 
アルミ-690x714.svg
 
スチール-704x656.svg
 
</pre>
 
 
 
* https://en.wikipedia.org/wiki/Food_safe_symbol
 
* https://en.wikipedia.org/wiki/Japanese_recycling_symbols
 
* https://en.wikipedia.org/wiki/Resin_identification_code
 

Revision as of 18:28, 2 March 2015

TODO

  • Translate the data page (http://fr.openfoodfacts.org/data) in English and make it available on all subdomains
  • Document all current API
  • Write further API specifications

API Basic Documentation

Reading a product

See http://fr.openfoodfacts.org/data or http://en.openfoodfacts.org/data


Searching for products

You can add &jqm=1 to search results pages on the web site to get results in a jquerymobile format.

e.g. http://world.openfoodfacts.org/cgi/search.pl?search_terms=coke&search_simple=1&jqm=1

Posting photos

  • Photos post on /cgi/product_image_upload.pl
code: the barcode
imagefield: "front"
imgupload_front : your image file

Posting a new product

var foodfact = { barcode : '3073780969000', name : 'KIRI GOUTER 280G 8 PORTIONS', energy: 500, energy_unit: "kJ", weight: 282 };
var postData = {
code : foodfact.barcode,
user_id : "mesinfosnutritionelles",
password : "****",
product_name : foodfact.name?foodfact.name:foodfact.shop_label,
quantity : foodfact.weight?""+foodfact.weight+" g":undefined,
stores : "Intermarché",
nutriment_energy :foodfact.energy,
nutriment_energy_unit :foodfact.energy_unit,
nutrition_data_per :"serving"
{"status_verbose":"fields saved","status":1}
  • code=3073780969000&user_id=usernameexample&password=*****&product_name=KIRI%20GOUTER%20280G%208%20PORTIONS&quantity=282%20g&stores=Intermarch%C3%A9&nutriment_energy=500&nutriment_energy_unit=kJ&nutrition_data_per=serving