api-documentation
api-documentation copied to clipboard
Document the API to retrieve all existing values of language specific fields for multilingual products
For language specific fields such as product_name or generic_name, the fields parameter of the read API enables to request a specific language (e.g. product_name_fr), or to set a preferred list of languages.
This feature allows to request a new field [field name]_languages with a hash with all existing values:
&fields=generic_name_languages:
product: { generic_name_languages: { en: "Chocolate cookies", fr: "Biscuits au chocolat" },
Pushed in production.
Sorry @stephanegigandet I don't see any documentation about it. I can write it if you don't have time but it has to be documented before closing.
To be sure I understand well, could you give a real URL example?
I found an example: https://world.openfoodfacts.org/api/v0/product/5425600101745.json&fields=product_name_languages (name in french and in german)
@stephanegigandet can you confirm the parameter only applies to products? So documentation should go in https://en.wiki.openfoodfacts.org/API/Read/Product, right?
So the documentation could be (between "Name" and "Barcode" sections):
===== List languages for product_name and generic_name fields =====
* https://world.openfoodfacts.org/api/v0/product/5425600101745.json&fields=product_name_languages
Returns all the languages and the corresponding values a field can have. Example:
<pre>
"product_name_languages": {
"fr": "Belgian mayonnaise",
"de": "Mayonnaise mit Ei"
}
</pre>
@CharlesNepote : yes, that's only for products.