on 06-29-2023 8:47 PM
Hi Experts,
I have created a CAP application, in which I have few tables and exposed an OData service as well which uses generic handlers.
Now when I am testing the service from rest client, I have observed that when I am trying make a PATCH/PUT call to service with an entry which is not present in the table, it is inserting the record instead of throwing an error.
I need to know whether this is the default behavior of PUT/PATCH in SAP CAP. (say whenever it finds an entry in the table it updates it, if it doesn't find an entry it goes ahead and creates it).
With Regards,
Partha.
Yes PATCH and PUT in CAP have UPSERT semantics. This is in line with the OData specification, which states that:
> To update an individual entity, the client makes a PATCH or PUT request to a URL that identifies the entity.
Source: http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_UpdateanEntity
> An upsert occurs when the client sends an update request to a valid URL that identifies a single entity that does not yet exist.
Source: http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_UpsertanEntity
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
11 | |
10 | |
8 | |
8 | |
6 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.