At Food Repo we believe in open data delivered using open source technologies and open web standards. The Food Repo API allows full access to all of the content available in the Food Repo database, including images.
For general information about our data license, how to contribute, and more, see here.
Our API is available to anyone using an API key generated using their Food Repo account. All API access is over HTTPS, and endpoints are subpaths of https://www.foodrepo.org/api/v3
. All data is sent and received as JSON.
Each request made against the Food Repo API must include your API key. The key must be passed in a Token header, like so:
Authorization: Token token="API_KEY"
Once you have an API key, check out our Swagger Documentation page which describes all our endpoints and their possible responses. You can perform live requests against our database, see exactly how to format your requests, and get a feel for what our API has to offer.
All endpoints returning a product (or products) will follow the Product Object Schema.
The /products
endpoint provides a links
object that follows the Links Object Schema.
The _search endpoint's functionality is provided through an ElasticSearch cluster. To perform searches, you'll need to familiarize yourself with a few things.
Example code for various languages may be found in this repo. Replace API_KEY
with your own key where necessary.
If you are using our API a lot, that's great! But telling our endpoints that you can accept a compressed response could reduce the response payload size by a factor of 10! That translates to snappier apps for your users and cheaper bandwidth costs for everyone. To enable compression, simply include the following header in your request:
Accept-Encoding: gzip
Note: Depending on the coding language or framework you are using to consume our API, you may need to do extra work to decompress the response.
We welcome any and all suggestions for improving and adding to the above documentation via Pull Request or Issue log.