Front End:
The front end will have a table. Data will be populated in few columns of the table already. The user will enter the remaining columns of data. The table will have multiple rows.
There will be two buttons. SAVE and SUBMIT. SAVE button is to temporarily store data and SUBMIT will send the final data to be stored.
DB:
Each row represents a record in database table
Table & UI both looks same:
Column1 Column2 Column3 Column4
----------------------------------------
Row1 | data | | data |
Row2 | data | | data |
Row3 | data | | data |
Row4 | data | | data |
Now, when the user click on SAVE button, I need to store the remaining column information in the database using REST API call.
What is the best way to design the REST API?
Questions in my mind,
1. If single record, I can use PATCH to do this. But multiple rows should be passed in the Request. How to frame my Request?
2. Should I use POST?
3. Should I pass all the rows as a List?
4. What if the user clicks on save multiple times? Will that increase the rest calls made and overload the network? How to efficiently handle this?