Line 4: |
Line 4: |
| [[API|← Back to API]] (required read) | | [[API|← Back to API]] (required read) |
| | | |
− | '''Please send a UserAgent HTTP Header with the name of the app/service querying, the version, system and an URL if you have one''', so that you are not blocked by mistake.
| + | == Use the API == |
− | | + | To use the read API, please check out the [https://openfoodfacts.github.io/openfoodfacts-server/api/ API documentation]. |
− | Example: <code>UserAgent: CoolFoodApp - Android - Version 1.0 - https://coolfoodapp.com</code>
| |
| | | |
| == Downloading static data == | | == Downloading static data == |
Line 18: |
Line 17: |
| | | |
| The character that separates fields is (tabulation). | | The character that separates fields is (tabulation). |
| + | |
| + | For an example on how to import it in postgres, see https://iderr.github.io/p/week-1-new-project-on-openfoodfacts/ |
| | | |
| ==== Encoding ==== | | ==== Encoding ==== |
Line 68: |
Line 69: |
| # https://ch-fr.openfoodfacts.org --> cc = ch, lc = fr (French) | | # https://ch-fr.openfoodfacts.org --> cc = ch, lc = fr (French) |
| | | |
− | === Over-riding Country code (cc) and Language of the interface (lc) using cc and lc parameters === | + | === Overriding Country code (cc) and Language of the interface (lc) using cc and lc parameters === |
| + | You can pass the field cc (e.g. <code>?cc=us</code>) and/or the field lc (e.g. <code>?lc=it</code>) to customize the results. |
| + | |
| + | For example, if you pass <code>?cc=us</code> and <code>&lc=it</code>, 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. <code>world.openfoodfacts.org?cc=frc</code> -> cc = fr, lc = en (default language of world) |
| | | |
− | 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 cc affects which results are returned. cc = fr -> you get only products with France listed in the countries where sold field. |
Line 82: |
Line 86: |
| == Viewing a product == | | == Viewing a product == |
| | | |
− | [[API/Read/Product]] | + | Have a look at: [[API/Read/Product]] |
| | | |
| == Searching for products == | | == Searching for products == |
| | | |
− | [[API/Read/Search]] | + | Have a look at: [[API/Read/Search]] |