【问题标题】:Retrofit 2. Posting a list of objects that include a file改造 2. 发布包含文件的对象列表
【发布时间】:2017-06-01 15:04:49
【问题描述】:

我需要能够发送包含每个对象图像的对象列表。

{
  id: 0,
  file="/yy/xx.png",
  answers=[yellow, brown]
},
{
  id: 1,
  file="/zz/foo.png",
  answers=[not yellow, not brown]
}

我该怎么做呢?我现在的想法是创建一个List<PartMap> 并发布。

【问题讨论】:

    标签: java android retrofit retrofit2


    【解决方案1】:

    用 3 个属性创建一个对象:int id、String file、String[] answers..然后设置这些对象,创建一个列表,然后在 @POST 的主体中发送

    【讨论】:

      猜你喜欢
      • 2019-07-26
      • 2021-09-17
      • 1970-01-01
      • 2018-12-31
      • 1970-01-01
      • 2015-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多