web services - Yii2 RESTful Webservice: JSON Request Format -
web services - Yii2 RESTful Webservice: JSON Request Format -
this first question:
i'm trying build restful webservice yii2. controller extends activecontroller , has corresponding model. reading of info works fine , without problems.
but when seek create new objects run error. utilize chrome extension advanced rest client , post next data:
{ "team": 1 } i tried different formats.
but response:
[{ "field":"team", "message":"team cannot blank." }] do have suggestions i'm doing wrong?
thanks!
i think got me on right track. that!
the problem yii2 uses integrated parser parsing json request. thought these parser konfigured default (as there no hint configure in documentation). parser had configured myself.
here how configure parser in main-configuration:
'request' => [ 'parsers' => [ 'application/json' => 'yii\web\jsonparser', ] ] you can find more info here: jsonparser
i hope can help others running same problem.
json web-services rest yii yii2
Comments
Post a Comment