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
POST /Foo(ID,IsActiveEntity=false)/draftActivate //> SAVE
315
315
DELETE /Foo(ID,IsActiveEntity=false) //> DISCARD
316
316
```
317
317
318
-
The key parameter `IsActiveEntity=false` addresses draft data, with the exception of `draftNew`, which is an _unbound_ action, and `draftEdit` for semantic reasons.
319
-
320
-
::: details `draftNew` actions are used <Sincepackage="@sap/cds"version="v10" /> and <Sincepackage="CAP Java"version="v5" />
321
-
Previously, regular `POST /Foo` requests without an `IsActiveEntity` parameter created new drafts, which caused ambiguities with requests to active data.
322
-
Can be disabled with <Config>cds.fiori.draft_new_action: false</Config>.
323
-
:::
318
+
The key parameter `IsActiveEntity=false` addresses draft data, with the exception of the empty POST and `draftEdit` for semantic reasons.
324
319
325
320
::: details Full HTTP requests ...
326
321
The requests above are abbreviated for clarity. The actual HTTP requests include the service path, content-type headers, and JSON bodies as shown below.
327
322
328
323
```http
329
-
POST /odata/v4/TravelService/Travels/draftNew
324
+
POST /odata/v4/TravelService/Travels
330
325
Content-Type: application/json
326
+
327
+
{}
331
328
```
332
329
```http
333
330
POST /odata/v4/TravelService/Travels(ID=a11fb6f1-36ab-46ec-b00c-d379031e817a,IsActiveEntity=true)/draftEdit
@@ -364,15 +361,21 @@ While this was always possible in CAP Java before, it's available for CAP Node.j
364
361
365
362
#### Draft-agnostic Requests
366
363
367
-
Taking this further, `IsActiveEntity=true` is assumed by default, so clients that are unaware of drafts or don't need to handle them can ignore all draft-specific requests and parameters:
364
+
Taking this further, through <Config>cds.fiori.draft_new_action: true</Config> `IsActiveEntity=true` is assumed by default, so clients that are unaware of drafts or don't need to handle them can ignore all draft-specific requests and parameters:
368
365
369
366
```php:line-numbers [Draft-agnostic requests to <i>active</i> data]
367
+
// creation of active instances
370
368
POST /Foo //> CREATE
371
369
GET /Foo(ID) //> READ
372
370
PATCH /Foo(ID) {...} //> UPDATE
373
371
DELETE /Foo(ID) //> DELETE
372
+
// creation of draft instances
373
+
POST /Foo/draftNew //> CREATE new draft [!code ++]
374
+
...
374
375
```
375
376
377
+
The previously used `POST /Foo` requests without an `IsActiveEntity` parameter to create new drafts is now replaced by the collection bound action `draftNew` to resolve the ambiguities with requests to active data.
378
+
376
379
::: details Available for CAP Node.js <Sincepackage="@sap/cds"version="v10" /> – not yet for CAP Java
377
380
Draft-agnostic requests as above assume `IsActiveEntity=true` by default for all requests that don't explicitly specify it.
378
381
This was possible in CAP Node.js, but not in CAP Java, which is still bound by the [*Olingo*](https://olingo.apache.org) library. For CAP Java, explicitly add `IsActiveEntity=true` as a key parameter to address active data
0 commit comments