Line 30: |
Line 30: |
| * /search will replace /cgi/search.pl as the url of search results | | * /search will replace /cgi/search.pl as the url of search results |
| * /api/v2/search will return JSON results, with the exact same parameters as the /search endpoint | | * /api/v2/search will return JSON results, with the exact same parameters as the /search endpoint |
| + | |
| + | === Selection of the fields returned === |
| + | |
| + | It is possible to specify which fields are returned for each result: |
| + | |
| + | * [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:meals&fields=code,product_name,brands,attribute_groups fields=code,product_name,brands,attribute_groups] |
| | | |
| === Simplified parameters specification === | | === Simplified parameters specification === |
Line 52: |
Line 58: |
| | | |
| * Per 100g or per serving | | * Per 100g or per serving |
− | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&energy-kj_100g%3C200&fields=code,product_name,energy-kj_100g energy-kj_100g < 200] | + | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&energy-kj_100g%3C200&fields=code,product_name,energy-kj_100g energy-kj_100g<200] |
− | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&sugars_serving%3E10g&fields=code,product_name,sugars_serving sugars_serving > 10] | + | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&sugars_serving%3E10g&fields=code,product_name,sugars_serving sugars_serving>10] |
| * Per the product as sold, or prepared | | * Per the product as sold, or prepared |
− | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&saturated-fat_100g=1&fields=code,product_name,saturated-fat_100g saturated-fat_100g=1 (as sold)] | + | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:sodas&saturated-fat_100g=1&fields=code,product_name,saturated-fat_100g saturated-fat_100g=1] (as sold) |
− | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:meals&salt_prepared_100g=1&fields=code,product_name,salt_prepared_100g salt_prepared_serving (prepared, per serving)] | + | ** [https://world.openfoodfacts.org/api/v2/search?categories_tags=en:meals&salt_prepared_serving=1&fields=code,product_name,salt_prepared_serving salt_prepared_serving] (prepared, per serving) |
| | | |
| == Development and deployment == | | == Development and deployment == |
Line 76: |
Line 82: |
| * [https://github.com/openfoodfacts/openfoodfacts-server/pull/4133 New Search API features + New Product Attributes] | | * [https://github.com/openfoodfacts/openfoodfacts-server/pull/4133 New Search API features + New Product Attributes] |
| * [https://github.com/openfoodfacts/openfoodfacts-server/pull/4240 New /search endpoint] | | * [https://github.com/openfoodfacts/openfoodfacts-server/pull/4240 New /search endpoint] |
| + | |
| + | == See also == |
| + | |
| + | [[Open Food Facts API Version 2]] |
| | | |
| [[Category:Project:Personalized_Search]] | | [[Category:Project:Personalized_Search]] |
| [[Category:ProductOpener]] | | [[Category:ProductOpener]] |
| + | [[Category:API]] |
| + | [[Category:Search]] |