Closed dosfx closed 3 years ago
The POST creates a new object, the PUT changes an existing one. So the first parameter of PUT is the objectid of the object you want to update.
I don't fully understand your code, but maybe:
axios.put("localhost:3000/object/"+ObjId, formData);
does the trick.
Thanks, @davidsneighbour for the explanation on PUT
@dosfx along with the id it needs the data to be saved as well!
I have a function on the server with a few parameters. If I set it as a POST request it will work, but if I set it as a PUT it will fail at validation, saying that it requires the first param. I can switch back and forth changing nothing else, and it will work as a POST, but fail as a PUT.
I'm using both Postman and axios js. Sending as
Content-Type: multipart/form-data
, both exhibit the same behaviour, works with POST, but not with PUT.What am I doing wrong?