['post'], 'create' => ['post'], ]; } public function actions() { $actions = parent::actions(); unset($actions['create']); return $actions; } public function actionCreate() { $model = new UserResponse(); $model->load(Yii::$app->getRequest()->getBodyParams(), ''); if ($model->save()) { $response = Yii::$app->getResponse(); $response->setStatusCode(201); // $id = implode(',', array_values($model->getPrimaryKey(true))); // $response->getHeaders()->set('Location', Url::toRoute(['view', 'id' => $id], true)); } elseif (!$model->hasErrors()) { throw new ServerErrorHttpException('Failed to create the object for unknown reason.'); } return $model; } }