Skip to content
Advertisement

PUT or PUSH for modifying the existing data?

I have viewset,

JavaScript

Which shows the view on /api/companys

There is a button for POST

enter image description here

I can add the new data from this form.

Now I want to modify the existing data.

I have basic questions.

  1. PUSH can modify the data? or PUT should be implemented?

  2. How PUT can be implemented for ModelViewSet?

Advertisement

Answer

Mainly for updating(modify) data using PATCH method, PUT for replace data

Description of methods: https://www.restapitutorial.com/lessons/httpmethods.html

To define PUT method you can use follow example:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement