小编Juz*_*lti的帖子

使用Retrofit发送多个动态字段

我们需要向需要动态多个字段的Web服务发送POST请求.

我的意思是,我们需要发送类似POST的请求:

question1='answer1'&question2='answer1'&question2='answer2'&question3='answer1'
Run Code Online (Sandbox Code Playgroud)

其中question1和question2未在编译时设置.我们知道我们可以使用@FieldMap来使用动态字段,但是我们不能多次发送同一个字段.

这是我们的改造代码:

@FormUrlEncoded
@POST("/desafios/send/")
Observable<BaseServerMsgArray> postSubmitSurvey(@Field("customerId") Long customerId, @Field("upload_from_app") int uploadFromApp, @FieldMap HashMap<String, ArrayList<String>> hashFields);
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我们吗?

提前致谢,

android retrofit retrofit2

8
推荐指数
1
解决办法
2585
查看次数

标签 统计

android ×1

retrofit ×1

retrofit2 ×1