i want to ask a question about using Retrofit 2 POST with Kotlin
this is the input that Postman does
"assets": {
"product": [
{
"eTag": "\"a59d9f11f3bfc643b00a96cabb8127a6\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "PD"
},
{
"eTag": "\"dd74783c22bdb8c7cf5ff0185297ee06\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "PD"
}
],
"barcode": [
{
"eTag": "\"3a4a0719d5fb9f5a1e4b6b9d246db4de\"",
"location": "https---abc.com/abc.png",
"filename": "abc",
"type": "BC"
}
]
}
this is from my interface
@FormUrlEncoded
@POST("create/newassets")
fun newAssets(
@Field("assets") assets: Asset? = null,
): Call<NewSkuResponse>
this is from my class assets
data class Asset(
@field:SerializedName("product")
var product: MutableList<DataItemAsset?>,
@field:SerializedName("barcode")
var barcode: MutableList<DataItemAsset?>
)
i got 400 bad request with it, i think my code not working fine any help, thank you
Solved by Oeganz,
It works like a charm with @Body