Hi,
I am wanting to utilise the data proxy save method to easily handle my server’s data. However I am not clear on the use of the “mode” parameter.
What is the difference between insert
and update
modes? For me, I assumed insert mode would do a POST
request whereas update mode would do a PUT
request. I created the following snippet, and looked in the developer console to track the network and noticed that both insert
and update
where doing a POST
request.
I was wondering if the inserting and updating were meant to have the same request method?
Yeah , insert/update/delete both are POST request. These are HTTP definition
If you will request something from server, it is a GET request. And if you wanna send something to server, it is a POST request
Hmmmmm. When I tested it, the delete
mode does as what I expected, which comes in as a DELETE
method and not a POST
.
However, it seems there is no difference between update and insert as they both did a POST
, so what would be the purpose of stating the mode
other than to decide if you want to delete or post? Wouldn’t it make sense for it to do PUT
if it is an update?
A lot of rest api seems to follow this trend where
update = PUT
,
insert = POST
,
delete = DELETE
Anyways, I was just wondering if this was a mistake in the code or if it was intentional