I’m not familiar with REST APIs, so I hope some expert will correct me if I’m wrong.
I would call REST APIs of the backend server in the frontend controller after it has successfully received the form submission. It will call some backend REST API instead of saving the data to the frontend db.
I’ll use http client in this case, it will be like this
if ($model->load(Yii::$app->request->post()) {
// sent to API Server
$client = new yii\httpclient\Client;();
$response = $client->createRequest()
->setMethod('POST')
->setUrl('http://example.com/api/1.0/users')
->setData(['name' => $model->name, 'address' => $model->address])
->send();
if ($response->isOk) {
// redirect or anything else
}
}