Php 移动应用程序有足够的API响应
我正在使用Laravel-Lumen为我的移动应用程序创建一个API,我有以下场景,我不知道返回对我的Android/IOS应用程序的响应的最充分的方式是什么 假设用户正在尝试登录(相同端点): 案例1:用户为登录提供正确的数据 案例2:用户使用错误的密码登录 案例3:用户不存在,必须先注册Php 移动应用程序有足够的API响应,php,laravel,lumen,Php,Laravel,Lumen,我正在使用Laravel-Lumen为我的移动应用程序创建一个API,我有以下场景,我不知道返回对我的Android/IOS应用程序的响应的最充分的方式是什么 假设用户正在尝试登录(相同端点): 案例1:用户为登录提供正确的数据 案例2:用户使用错误的密码登录 案例3:用户不存在,必须先注册 我的问题是,我的API响应应该是什么样的,以便我能够在我的应用程序逻辑中区分这些情况,并相应地向前推进(我需要知道发生了哪种情况)?您的响应如下- Use this response if request
我的问题是,我的API响应应该是什么样的,以便我能够在我的应用程序逻辑中区分这些情况,并相应地向前推进(我需要知道发生了哪种情况)?您的响应如下-
Use this response if request validated successfully.
{"status":"OK", "message":"success"}
Use this response if user not exist.
{"status":"FAIL", "message":"not_register"}
Use this response for invalid credentials.
{"status":"FAIL", "message":"invalid_credentials"}
您的答复如下:
Use this response if request validated successfully.
{"status":"OK", "message":"success"}
Use this response if user not exist.
{"status":"FAIL", "message":"not_register"}
Use this response for invalid credentials.
{"status":"FAIL", "message":"invalid_credentials"}
谢谢伙计,我将以整数值(状态代码)的形式跟踪状态谢谢伙计,我将以整数值(状态代码)的形式跟踪状态