4 ms·
Adhoc querying of multiple resources and REST are not incompatible, see e.g. oData. It basically offers the same functionality as GraphQL, but also follows all
by ako 8y ago
Adhoc querying of multiple resources and REST are not incompatible, see e.g. oData. It basically offers the same functionality as GraphQL, but also follows all the Restfull http best practices.
You can see some oData examples here: https://www.odata.org/getting-started/basic-tutorial/#requestData https://www.odata.org/getting-started/basic-tutorial/#reques...
- geezerjay 8y ago> Adhoc querying of multiple resources and REST are not incompatible, see e.g. oData. This. Sometimes I wonder if graphql proponents either are unaware of established REST strategies and tooling or if they intentionally turn a blind eye .
- allover 8y agoIn terms of ease of building a query (and resulting ease of comprehension of that query) that will give you the exact response structure you want from the client-side, the two are not comparable, there is no blind-eye turning in this regard as far as I can tell. But I'd love to see an REST-based GraphiQL equivalent to prove this wrong: https://github.com/graphql/graphiql https://github.com/graphql/graphiql
- napoleond 8y agoAFAIK, oData only lets you request a single entity type at a time, doesn't it? For example, in the example you provided, would it be possible to fetch a collection of People and Airports as part of the same request? What would that request look like?
- jmull 8y agoNo, you can batch requests.
- wsy 8y agoThe question was not about batching, it was about join queries over more than one resource type.
- jmull 8y agoI guess I should be more clear... batch means you can do things like combine these: GET /serviceRoot/Airports GET /serviceRoot/People into one request (and get the results in one response) I believe that's what the poster was asking. Here's a link to a different example from the OData site: https://www.odata.org/getting-started/advanced-tutorial/#batch https://www.odata.org/getting-started/advanced-tutorial/#bat... You're using the word "join". I'm not sure if you meant that in a relational sense or not. If yes, then maybe you're wondering if you can get airports with their related people, or people with their related airports in one request with OData. Again, the answer is yes.
- jbreiding 8y agoNo, you can query a collection of these entities and get back the resulting set with pagination.
- ako 8y agoYou can include associated entities by using expand, e.g. order with orderlines. See: https://www.odata.org/getting-started/basic-tutorial/#expand https://www.odata.org/getting-started/basic-tutorial/#expand The oData contract, $metadata, describes an entire domain model, including associations between entities. You can use expand to join entities over these associations. You can request multiple queries in one http operation using batch requests: https://www.odata.org/getting-started/advanced-tutorial/#batch https://www.odata.org/getting-started/advanced-tutorial/#bat...
- ben509 8y agoThat's REST + oData, not REST. GraphQL includes adhoc querying in the standard. Otherwise I could claim ISAM is just like a SQL database because MySQL is a SQL database built on top of ISAM.
- ako 8y agoNo, not REST + oData. oData is an http protocol which conforms to all of the REST best practices (url is identifier of a resource, use of http operations, use of http error codes, providing links to other resource, payload contains a representation of state).