[英]How to send array request in body parameter retrofit android
這是我的請求,我需要在 @Post 請求中以Data作為鍵發送。 請幫助我自 2 天以來就被困住了。
[
{
"barcodeList": "abc",
"fieldboyId": "17",
"lattitude": "37.4219513",
"longitude": "-122.0841169",
"quantity": "2",
"refrenceId": "1",
"sampleId": null,
"sampleName": null,
"sampleType": null,
"type": "Barcode"
},
{
"barcodeList": "acd",
"fieldboyId": "17",
"lattitude": "37.4219513",
"longitude": "-122.0841169",
"quantity": "1",
"refrenceId": "1",
"sampleId": null,
"sampleName": null,
"sampleType": null,
"type": "Barcode"
}
]
您可以制作這些課程:
public class RequestBody {
List<Data> data;
public class Data {
String barcodeList;
String fieldboyId;
String lattitude;
String longitude;
String quantity;
String refrenceId;
String sampleId;
String sampleName;
String sampleType;
String type;
}
}
在界面中類似於
@POST("/api/path")
Call<Something> myPostRequest(@Body requestBody: RequestBody);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.