我有一个 laravel 网页和一个 android 应用程序。我正在使用 retrofit2 让两个站点进行通信。我知道如何从网页获取我的应用程序中的数据。我这样做: 我有一个从 jsonschema2pojo 获得的“数据”模型。在我的活动中,我填写了那个“数据”对象,但是到了发送该信息的时候,我不知道该怎么做。 我的 ApiService 是这样的:
@POST("api/data/configuration")
Call<Data> postConfigurationData(@Body Data datos);
在我的活动中,我发送这样的“数据”对象:
Call<Data> dataCall=service.postConfigurationData(datosNuevos);
“datosNuevos”是我的“数据”对象。
我是否必须在我的 laravel 网页的控制器中创建相同的路由:“api/data/configuration”?在那种情况下,它会是一个获取请求吗? 谢谢。
编辑
Route::post("data/configuration",[ConfigurationController::class,'getDataConfiguration'])->name('configurations.getDataConfiguration');