You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/wwl-data-ai/integrate-sql-solutions-azure-services/4-expose-database-objects-stored-procedures-views.yml
Copy file name to clipboardExpand all lines: learn-pr/wwl-data-ai/integrate-sql-solutions-azure-services/includes/3-define-entities-rest-graphql.md
+94Lines changed: 94 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -216,3 +216,97 @@ query {
216
216
```
217
217
218
218
The `cardinality` property indicates whether the relationship returns one item or many. Use `one` for many-to-one relationships (product to category) and `many` for one-to-many relationships (category to products).
219
+
220
+
## Understand REST endpoint generation
221
+
222
+
When you define an entity, DAB automatically creates REST endpoints following standard conventions. Each entity gets a base URL path, and HTTP verbs map to CRUD operations.
223
+
224
+
For an entity named `Product` with the default configuration:
225
+
226
+
| HTTP Method | URL Pattern | Operation |
227
+
|-------------|-------------|-----------|
228
+
| GET |`/api/Product`| List all products (paginated) |
229
+
| GET |`/api/Product/id/123`| Get product with ID 123 |
230
+
| POST |`/api/Product`| Create a new product |
231
+
| PUT |`/api/Product/id/123`| Update or create product 123 |
The `/id/` segment in URLs indicates a primary key lookup. For composite keys, chain multiple key segments: `/api/OrderDetail/orderId/100/productId/50`.
236
+
237
+
## Customize REST endpoint paths
238
+
239
+
You can modify the default URL patterns through entity configuration. The `rest` section controls REST-specific behavior:
The `path` property changes the URL from `/api/Product` to `/api/products`. This setting is useful when you want lowercase, plural endpoint names that differ from your entity names.
260
+
261
+
The `methods` object lets you enable or disable specific HTTP verbs. In this example, `PUT` is disabled, which prevents full record replacement while still allowing `PATCH` for partial updates. This configuration pattern protects against accidental data loss from clients that might send incomplete records.
262
+
263
+
> [!TIP]
264
+
> Disabling methods at the endpoint level provides defense in depth. Even if permissions allow an action, disabling the method prevents it entirely.
265
+
266
+
## Set up GraphQL endpoint configuration
267
+
268
+
GraphQL operates through a single endpoint, typically at `/graphql`. All queries, mutations, and subscriptions go through this endpoint, with the request body specifying the operation.
269
+
270
+
```json
271
+
"runtime": {
272
+
"graphql": {
273
+
"enabled": true,
274
+
"path": "/graphql",
275
+
"allow-introspection": true,
276
+
"depth-limit": 8,
277
+
"multiple-mutations": {
278
+
"create": { "enabled": true }
279
+
}
280
+
}
281
+
}
282
+
```
283
+
284
+
The `allow-introspection` setting controls whether clients can query the GraphQL schema itself. During development, introspection helps tools like GraphiQL and Apollo Studio understand your API. In production, consider disabling it to hide implementation details.
285
+
286
+
The `depth-limit` setting prevents overly complex nested queries that could strain your database. A depth of 8 allows reasonable relationship traversal while blocking potential abuse through deeply nested queries.
287
+
288
+
## Configure GraphQL-specific entity settings
289
+
290
+
Each entity can have GraphQL-specific configuration that differs from REST:
The `type` property customizes the GraphQL type names. By default, DAB uses the entity name, but you can specify different singular and plural forms.
311
+
312
+
The `operation` property determines where mutations appear. Use `query` for read-only entities (like views) or `mutation` for entities that support write operations.
0 commit comments