Launch of new product images schema and new API to retrieve, upload and select images

In the past months, we have been working on a project called Pomme d’API to improve and simplify the Open Food Facts API. We submitted this project to the NGI Zero Commons call and we were delighted that it was selected to be funded. Today we launched the first milestone of the project: a revamp of the photos upload API that caused a lot of issues to app developers in the past 12 years.

We took this opportunity to also change the structure of the uploaded and selected product images in the Open Food Facts database and API, to make it easier to understand (even without reading the documentation). We also documented the new schema for images in OpenAPI.

This update is the biggest breaking change so far in the product schema, so we introduced new features to allow maintaining backward compatibility. Each product object now has a schema_version, and depending on the API version you use, we upgrade and/or downgrade the schema so that you get the product structure you expect. We now also maintain a list of changes for each schema version and indicate which API version it corresponds to.

This means that existing API users should not see a difference from this launch, unless they change the requested API version to be 3.3 or greater. We do recommend that you upgrade to the new version, but you can do it on your own timing.

For new API uses, it’s best to use the latest available version of the API (3.3 currently).

We also introduced new endpoints to upload and select images (the old endpoints were just a wrap-up on the CGI forms used on the Open Food Facts website to add and edit images).

The new endpoints are documented in the OpenAPI documentation: POST /api/v3.3/[barcode]/images

This new image structure and new API is a big change. We did our best to test the changes, and the code changes were reviewed by multiple people (thank you!), but it’s always possible that we forgot something. So if you find something strange, please do let us know.

In parallel to the restructuration of images data, we are also working on restructuring the nutrition facts data. We have made some proposals for the new nutrition facts data structure, and it would be great to get your feedback.

Thank you!

2 Likes