private ApiWrapper() {
LogUtils.e("ApiWrapper---baseUrl:" + BASE_URL);
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
.addInterceptor(logging)
.build();
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.client(okHttpClient)
.build();
}
@POST("/Business/QuickInventory")
Observable<Result<User>> quickInventory(
@Query("jsonParam") String jsonParam,
@Query("userParam") String userParam,
@Query("sign") String sign);
ApiWrapper.getInstance()
.create(InventoryApi.class)
.quickInventory(JSONUtils.obj2json(inventoryItems), JSONUtils.obj2json(inventoryUser), sigh)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getInventorySubscriber());
When the inventoryItems have 22 item, the API work well.
But when the inventoryItems over 22, it's not work.
The problem is parameter too long my backed developer said.
Sorry for my bad English. Thanks your help.
How can it fix it?
Consider using @FormUrlEncoded and @FIeld so that the contents are posted in the request body instead of the URL. That requires your server to support this mechanism though.
This isn't a Retrofit issue. Please ask future usage questions on StackOverflow using the 'retrofit' tag.
Most helpful comment
Consider using
@FormUrlEncodedand@FIeldso that the contents are posted in the request body instead of the URL. That requires your server to support this mechanism though.This isn't a Retrofit issue. Please ask future usage questions on StackOverflow using the 'retrofit' tag.