cancel
Showing results for 
Search instead for 
Did you mean: 

CAP: How to get newly created entity via cds api?

iashishsingh
Participant

Hello,

When we use OData services exposed via CDS, a POST request on an entity creates a new row and also returns it as part of the response body. How can I have this newly created row of data when making use of cds apis insider the custom handlers?

My goal is to create a new row of data by using cds.transaction or INSERT.into() or similar APIs inside event handlers of a service definition. Currently, these apis return the number of affected rows for Insert, Delete and Update calls.

Thanks,

Ashish

View Entire Topic
AndreM
Explorer
0 Kudos

How would I retrieve things with an additional SELECT if I only get the number of affected rows? How would I know what to select, if I don't get the affected IDs back from the call? Especially in the case of an INSERT where I don't have any clue about what has been created with which ID ...

How could that be "how database clients work"? How can anyone work with that?

me: "please create some entries with the following values"

db: "done that, created 5 entries"

me: "what are the keys you created for them so I can find them?"

db: *shrug*

...