3 ms·
Ask HN: Would allowing multiple querystrings in URLs allow more scalable APIs?
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.
- scarface74 7y agoI think you are describing OData. https://www.odata.org/documentation/odata-version-2-0/uri-conventions/ https://www.odata.org/documentation/odata-version-2-0/uri-co...
- kizer 7y agoCorrect 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.
- scarface74 7y agoNever used OData. It just popped into my head when I saw the question.
- kizer 7y agoI 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.