Jump to content

Open Food Facts Search API Version 2: Difference between revisions

→‎Examples: added web site endpoint
(→‎Examples: V1 and V2 of the API)
(→‎Examples: added web site endpoint)
Line 14: Line 14:
Products from the chocolate category, with both the organic label and the fair trade label:
Products from the chocolate category, with both the organic label and the fair trade label:


* V1: https://world.openfoodfacts.org/cgi/search.pl?action=process&tagtype_0=categories&tag_contains_0=contains&tag_0=chocolates&tagtype_1=labels&tag_contains_1=contains&tag_1=organic&tagtype_2=labels&tag_contains_2=contains&tag_2=fair-trade&json=1 (cannot select the fields returned)
* V1:
* V2: https://world.openfoodfacts.org/api/v2/search?categories_tags_en=chocolates&labels_tags_en=organic,fair%20trade&fields=code,product_name (returns only selected fields)
** https://world.openfoodfacts.org/cgi/search.pl?action=process&tagtype_0=categories&tag_contains_0=contains&tag_0=chocolates&tagtype_1=labels&tag_contains_1=contains&tag_1=organic&tagtype_2=labels&tag_contains_2=contains&tag_2=fair-trade&json=1 (cannot select the fields returned)
* V2
** https://world.openfoodfacts.org/api/v2/search?categories_tags_en=chocolates&labels_tags_en=organic,fair%20trade&fields=code,product_name (returns only selected fields)
** https://world.openfoodfacts.org/search?categories_tags_en=chocolates&labels_tags_en=organic,fair%20trade&fields=code,product_name (corresponding Web site endpoint)


== Features ==
== Features ==