Help - POST request values is empty


(Piro) #1

Hey there!

I followed the instructions from yii docs "guide-rest-quick-start" , but when i try to make this request


curl -i -H "Accept:application/json" -H "Content-Type:application/json" -XPOST "myapp/users" -d '{"username": "example", "email": "user@example.com"}'

the values is going blank to database. Whyy??


(Chandrantwins) #2

Hi,

This is not enough to debug. Please post your controller code


(Nacevedo) #3

Try to use $_REQUEST instead of Yii::$app->request->post() or $_POST

[b]

[/b]

But check if the params are sent. Siometimes seems to work, sometimes not.