How do I pass a bodyparameter for Rx2AndroidNetwor

2019-08-03 02:58发布

I am working on retrieving some endpoints in a helper class with Rx2AndroidNetworking. However, there is no way I can pass "addBodyParameter" with get requests (only works for post and put requests". I was wondering if there's a way around it? My postman query looks like this (which does return proper results once i add the "my_session_token" in the body as shown below: enter image description here However, I am not sure how that pans out with my code. My code for retrieving it is as follows:

   @Override
    public Single<MyResponse> getMyApiCall(String userId) {
        return Rx2AndroidNetworking.get(processUrl(ApiEndPoint.MY_ENDPOINT))
                .addPathParameter("userid", userId)
                .addHeaders("Auth", mApiHeader.getFormattedProtectedApiHeader())
//I want the below line to be addBodyParameter, but doesnt work
                .addQueryParameter("my_session_token", mPreferencesHelper.getMyToken())
                .build()
                .getObjectSingle(MyResponse.class);
    }

Any idea how to go about this? Thanks!

0条回答
登录 后发表回答