Skip to content

Boris-c/openfood_api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenFood Logo

OpenFood API

Overview

At OpenFood we believe in open data delivered using open source technologies and open web standards. The OpenFood API allows full access to all of the content available in the OpenFood database, including images.

Newsletter

Stay informed about OpenFood, and sign up for our newsletter.

License

All content, including images, is licensed under CC BY 4.0

Current Version

By default, all requests receive the v2 version of the API.

Schema

All API access is over HTTPS, and accessed from https://openfood.ch. All data is sent and received as JSON.

The OpenFood API is based on the JSON API Specification for resources access, while the search functionality is provided through an ElasticSearch cluster. The search endpoints use ElasticSearch query language.

Authentication

Developer API Key

Sign up for a developer account on OpenFood and visit the API Keys page. This key must be passed with all requests, in the header.

You may request multiple API keys, and they may be deactivated or deleted at anytime by you. Once a key is deactivated or deleted it cannot be reused.

Provide the API key in the Request headers

Each request made against the OpenFood API must include your API key. The key must be passed against a Token header, like:

Authorization: Token token="[API_KEY]"

All traffic accessing OpenFood must travel across HTTPS.

Swagger Documentation

The API is documented via the OpenAPI Specification via a Swagger interface. This may be found on the documentation page.

The documentation may be freely viewed without an account. Using your developer API Key, you can run live queries against the API and view the generated curl statements.

Endpoints examples can be found here

Search Endpoints

Search endpoints, which contain the _search string are served using ElasticSearch. As such the full ElasticSearch Query DSL may be applied to OpenFood data.

Examples of search can be found here

Example Code

Example code for various languages may be found in this repo. Replace [API Key] with your own key where necessary. We currently support examples for

Issues Log

Please log any issues, enhancement requests or code questions in the Issues log.

Slack Channel

You can also contact us and other community developers via the Slack channel.

Contributing

We welcome any suggestions or feature requests, please log an issue. Changes to this documentation or sample code is also welcome ... just make a pull request.

About

OpenFood API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 53.2%
  • HTML 20.4%
  • JavaScript 20.3%
  • Ruby 3.1%
  • Python 3.0%