I am referring this SO Thread but unable to generate proper api request. api request is as below
Request :
{
"clientId": "v@gmail.com",
"products": {
"productNumber": "8123456789123",
"batchNumber": "123456789",
"quantity": 50,
"salesPrice": 500,
"purchasePrice": 500,
"MRP": 600,
"mfgDate": "15/05/2017",
"expDate": "15/05/2017"
}
}
Api Interface
@FormUrlEncoded
@POST("/products/addBatch")
public Observable<AddBatchResponse> doAddBatch(@Header(WebServicesTags.TAG_AUTHORIZATION) String token,
@Field(WebServicesTags.TAG_CLIENT_ID) String clientId,
@Body BatchModel product);
and following is my Api call
BatchModel model = new BatchModel(productNumber, batchNumber, quantity, salesPrice, purchasePrice, mRP, mfgDate, expDate);
Observable<AddBatchResponse> addBatch = apiservice.doAddBatch(sessionManager.getKeyToken(), sessionManager.getKeyEmail(), model);
addBatch.subscribeOn(Schedulers.newThread())
call this api shows me below Error
java.lang.IllegalArgumentException: @Body parameters cannot be used with form or multi-part encoding.