flagr icon indicating copy to clipboard operation
flagr copied to clipboard

Extend API with GET evaluation request

Open iamafanasyev opened this issue 10 months ago • 8 comments

What are your thoughts on extending the existing evaluation API with functionally equivalent (to POSTs) GET requests (e.g. GET /evaluation and GET /evaluation/batch)?

Several pros could be observed from general perspective (like idempotency of evaluate), but the main actual reason I'm asking is that my client feature flag request is time critical, and:

  1. POST /evaluation/batch ...
    ...
    Content-Type: application/json
    ...
    
    is always not a simple request from CORS perspective, so a preflight request is always spawned (and it is quite important for us to have an option to keep our services on different hosts for some organisational purposes);
  2. there is no option to preload the request (by inlining it in the resulting client's HTML);
  3. GET request is more straightforward from cache control perspective (e.g. when your application shares the same feature flags across different "pages").

(at the moment we address these drawbacks at the infrastructure level: edges/lambdas, reverse proxies, etc.)

Cons are obvious I guess — URL length limitations. Any other?

iamafanasyev avatar Apr 14 '25 12:04 iamafanasyev

Hm, well I was a little biased by our Flagr use case: we use batch evaluation mostly in terms of "flags' batch" (one entity context, many flags, selected by tags). But POST /evaluation/batch could have another semantics — many entity context, many flags. And that would be non-trivial to map onto query parameters (yet not impossible, several evaluation entities could be passed as several "JSON-encoded" query parameters, e.g. evalEntity='{"entityID":"a1234","entityType":"report","entityContext":{"hello":"world"}}'&evalEntity='{"entityID":"a5678","entityType":"troper","entityContext":{"hello":"world"}}'). So still interested in your thoughts

iamafanasyev avatar Apr 15 '25 10:04 iamafanasyev

that looks nice, do you want to create a PR for it? GET's query has a length limit like 2000 characters, maybe that's enough for most cases.

nothing0012 avatar Apr 18 '25 21:04 nothing0012

yep, i'll make it

iamafanasyev avatar Apr 19 '25 17:04 iamafanasyev

hey, @nothing0012, could you take a look the proposed api changes?

iamafanasyev avatar May 19 '25 17:05 iamafanasyev

Stale issue message

github-actions[bot] avatar Jul 18 '25 21:07 github-actions[bot]

@nothing0012 @marceloboeira hi! what do you think about this ?

foxdalas avatar Aug 12 '25 08:08 foxdalas

Stale issue message

github-actions[bot] avatar Oct 11 '25 21:10 github-actions[bot]

@nothing0012 hi! Can you check the PR?

foxdalas avatar Oct 11 '25 22:10 foxdalas