I can use GET from my test JSON server, but cannot use PUT or POST

167 views Asked by At

This is my testing server: https://my-json-server.typicode.com/EmreYavuzalp/jsonTestEtmeAraci

I can get the contents of the employees from here. With this:

curl -XGET 'https://my-json-server.typicode.com/EmreYavuzalp/jsonTestEtmeAraci/employees'

But cannot do the PUT at all. Neither POST. I tried it both ways. It just shows {} (empty brackets), not even an error code. What would that mean? I use this code to put:

curl -X PUT https://my-json-server.typicode.com/EmreYavuzalp/jsonTestEtmeAraci/employees/ \
-d '{"employees":[
  { "firstName":"Emre", "lastName":"Emre" }
]}'

I tried to remove "employees" and send it that way:

curl -X PUT https://my-json-server.typicode.com/EmreYavuzalp/jsonTestEtmeAraci \
-d '{
"firstName": "Emre",
"lastName": "Emre"
}'

And if I do POST, it says

TypeError: Cannot read property 'id' of undefined

Still doesn't work. What could be wrong here? It doesn't return any error code.

0

There are 0 answers