-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store the source to know from which apps the prices are created #302
Comments
@monsieurtanuki @teolemon a few questions :
current PR 👇
any specific recommentation on the name to use ? |
I was more thinking about letting clients send arbitrary parameters as opposed to trying to be smart and getting the user agent. |
How is it done already ? I'd rather simply replicate your current behavior on the main app. But maybe you don't store it actually ? |
@raphodn This is currently the "user agent" we use in off-dart: class UserAgent extends JsonObject {
/// The name of your application (eg: smooth-app)
final String name;
/// The version of the application (1.0.0)
final String? version;
/// The system running the application (eg: Android+10)
final String? system;
/// The url of your application (eg: https://example.com)
final String? url;
/// Additional information about your application
final String? comment;
// ...
And we use it approximately this way, adding parameters to map['app_name'] = OpenFoodAPIConfiguration.userAgent!.name;
map['app_version'] = OpenFoodAPIConfiguration.userAgent!.version!;
map['app_uuid'] = OpenFoodAPIConfiguration.uuid!;
map['app_platform'] = OpenFoodAPIConfiguration.userAgent?.system ?? '';
map['comment'] = OpenFoodAPIConfiguration.userAgent?.comment ?? ''; In short: we somehow add 5 parameters to
|
https://openfoodfacts.github.io/openfoodfacts-server/api/#authentication So the |
The documentation is outdated, we now have a structured way to do it. |
I've created a doc PR: openfoodfacts/openfoodfacts-server#10368 |
Sorry to insist 😅 Can you give a concrete example of a GET & POST request ? To see if these parameters are in the url, or in the body, or in the headers... And what other (web) apps can I inspect that pass these info to the backend ? I just checked hunger games and I don't see anything for instance |
@raphodn I'm French and I'm an engineer, therefore I have to say: it depends. AFAIR we can use our user agent in the header (rather for http server stat purpose), and as query parameters (for more refined stat purpose). Always in the header, and sometimes as query parameters too. As I said in a previous message our user agent is split in 1 mandatory field (
For instance, for our "get product by barcode" query:
|
Thanks @monsieurtanuki for the detailed answer. So I'd rather not store the User Agent then (and leave it for http server stats), but look at the I'll implement this in the backend & web frontend ! |
@monsieurtanuki ok it's in prod. simply passing a I did the changes in the frontend web app and it's in prod as well : openfoodfacts/open-prices-frontend#588 |
Hi @raphodn! I've just tested in But where am I supposed to see the |
The field is for internal stats only for now :) Not sure if there is any value in returning that data in the JSON responses. You're right the naming is similar to the flavor, i'll see if I rename it or leave it as is for the time being.. |
@raphodn I would suggest naming it |
Ideally i would rename |
If so, please create a specific issue for that in https://github.com/openfoodfacts/openfoodfacts-dart |
Story
Price.source
fieldProof.source
fieldapp_name
URL param (see discussion below)app_name
param) : feat(API): send the app_name param in every API call open-prices-frontend#588app_version
: see Price/Proof source: store mobile app version #502Location.source
fieldWhy
To differentiate the apps that interact with the API and create the prices.
Related issues
Following discussion here : openfoodfacts/smooth-app#5195
The text was updated successfully, but these errors were encountered: