prooph/event-store-http-api

Allow filtering by metadata

codeliner opened this issue · 3 comments

How do we want to design the filter capabilities?

We can load and loadReverse with an optional MetadataMatcher but how do we expose those filters in the http-api?

Two options:

  1. Using query params in the format: ?meta_1_field=_aggregate_id&meta_1_operator=eq&meta_1_value=abcd-efgt-ijklmnop&meta_2_field=_aggregate_version&meta_2_operator=gte&meta_2_value=10

We could also shorten the params so that meta_1_field becomes m_1_f for examle
And meta_<no>_operator could be optional and default to eq
This would save a lot of characters because the length of an URI is somewhat limited.

  1. Use POST and send filters as JSON in the request body.

Also related to prooph/event-store#284

If we decide for option 1, I'd suggest prop_<no>_<field|operator|value> or p_<no>_<f|o|v>

I would say let's use post and json for this.

Problem with POST:

  • wrong http method for queries
  • is not cached
  • maybe conflict with "real" POST requests to the same url