I’m developing java library which will be interfacing one of our legacy system. All calls are via REST request. Body of each request is url encoded form.
But here is a problem, each form has single field which contains stringified JSON object with all arguments. I was wonder what will be best practice to replicate this using Retrofit library?
Currently I’m thinking about defining my request as,
@FormUrlEncoded @POST("request") Call<Response> request(@Field("payload") String payload);
and create layer between Retrofit and request.
Is it better solution which allows me to define request which fields which are relevant for given request ie
@FormUrlEncoded @POST("request") Call<Response> request(@Field("field1") String field1, @Field("field2") String field2);
and pre process them to create body required for given request