0

I have been trying to fire some PUT queries to the backend (json-server) using Chrome POSTMAN.

It does not add a new record as per its definition (Update if existing AND Add if not present).

HTTP PUT request snap

However on doing a HTTP GET, the new record is not added .

HTTP GET request snap

Wondering if this is the expected behaviour.

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
Ameya
  • 17
  • 4
  • What does the `API` documentation say? – DarkBee Sep 16 '18 at 11:46
  • Hello @ameya, PUT and POST itself has no magic do to things, Its like standard. We have to write logic behind it as per standards. So you must check how POST and PUt are implemented in your application – VedantK Sep 16 '18 at 11:50
  • PUT puts a file or resource at a specific URI, and exactly at that URI. If there's already a file or resource at that URI, PUT replaces that file or resource. If there is no file or resource there, PUT creates one. PUT is idempotent, but paradoxically PUT responses are not cacheable. – Ameya Sep 16 '18 at 11:54
  • As per (https://stackoverflow.com/questions/107390/whats-the-difference-between-a-post-and-a-put-http-request) – Ameya Sep 16 '18 at 11:54
  • Hello @VedX , Actually this is not a MVC based application as in I have not implemented REST Controllers as we do in Spring. This is rather creating on-the-fly REST services using json-server – Ameya Sep 16 '18 at 11:57

0 Answers0