Difference between revisions of "Taxonomy access"

From Open Food Facts wiki
Jump to navigation Jump to search
(moving Finding new opportunities for taxonomization)
 
(One intermediate revision by one other user not shown)
Line 8: Line 8:
 
Example for categories:  
 
Example for categories:  
 
* https://static.openfoodfacts.org/data/taxonomies/categories.json
 
* https://static.openfoodfacts.org/data/taxonomies/categories.json
* https://static.openfoodfacts.org/data/taxonomies/categories-full.json
+
* https://static.openfoodfacts.org/data/taxonomies/categories.full.json
  
 
=== Taxonomy API ===
 
=== Taxonomy API ===
Line 23: Line 23:
 
[https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots&lc=en%2Cfr&cc=fr https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots&lc=en,fr&cc=fr]
 
[https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots&lc=en%2Cfr&cc=fr https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots&lc=en,fr&cc=fr]
 
[[Category:Taxonomies]]
 
[[Category:Taxonomies]]
 +
[[Category:API]]

Latest revision as of 10:01, 26 August 2024

Getting taxonomies files

Taxonomies in JSON format

Every taxonomy is also available as a json on OpenFoodFacts. Use

  • https://static.openfoodfacts.org/data/taxonomies/<taxonomy name>.json
  • or https://static.openfoodfacts.org/data/taxonomies/<taxonomy name>.full.json to get additional properties

Example for categories:

Taxonomy API

We have a basic taxonomy API to get information about a taxonomy.

Eg. to get information about en:carrots entry in categories taxonomy:

https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots

you can add lc (language code) parameter to ask for more than one language. cc is used for country code.

Eg. to add french information on previous request:

https://world.openfoodfacts.org/api/v2/taxonomy?tagtype=categories&tags=en:carrots&lc=en,fr&cc=fr