1.经常使用的时候给后台传递的json格式的请求报文
如下面
/**
* 会员登录
*
* @param loginRequest
* @param token
* @return
*/
@Headers({"Content-Type: application/json", "Accept: application/json"})
@POST("api/ms.cust/req_login")
Call<Login> Login(@Body LoginRequest loginRequest, @Header("authorization:token") String token);
2.也有不是json的情况下
如萤石的请求报文
/**
*POST /api/lapp/device/capacity HTTP/1.1
*Host: open.ys7.com
*Content-Type: application/x-www-form-urlencoded
*accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=427734203
*萤石摄像头查询设备能力集合
*/
@Headers({"Content-Type: application/x-www-form-urlencoded" , "Accept: application/json"})
@POST("api/lapp/device/capacity")
@FormUrlEncoded
Call<QueryDeviceFunctionResponse> queryDeviceFunction(@Field("accessToken" ) String accessToken,@Field("deviceSerial")String deviceSerial);
网友评论