Ask HN: Would allowing multiple querystrings in URLs allow more scalable APIs?

3 points by kizer ↗ HN
Imagine if could GET `https://bar.mywebsite.foo/gadgets?name=foo&age>=100/gizmo/components?type=types.gizmo.component.square`.

I know it's ugly and not legal URI syntax, but this could cut N GETS into one, where, as one possibility, the server could compile the path into the separate requests (if necessary). Then again, I guess this transformation could happen client-side.

It seems like repeated filtering is always involved in getting some desired resource; it would be great to get this with one request. Perhaps that newcomer GraphQL addresses this by design.

Often I wonder if the best HTTP API would involve the remote execution of some non-turing-complete query-language guaranteed to terminate. Just select, filter, basic "joins", etc.

4 comments

[ 3.2 ms ] story [ 22.0 ms ] thread
Correct me if I'm wrong, but it looks like you can't just keep going and appending more to the path; the metadata document seems to dictate how parameters are applied to resources in the preceding path.
Never used OData. It just popped into my head when I saw the question.
I had just heard of it. Looks like what I was getting at. Wish APIs were just exposed through some query language. Don't see apparent harm if it's read-only and permission-restricted.