retrofit

Unable to create converter for class

对着背影说爱祢 提交于 2019-12-24 07:06:10
问题 I am using retrofit in my app and Gson convertor for JSON. I would like to use database when there is not internet connection. I decided to use Sugar ORM. but I get an IllegalArgumentException . java.lang.IllegalArgumentException: Unable to create converter for class here is my object public class User extends SugarRecord implements Parcelable { @SerializedName("id") @Expose private Integer id; @SerializedName("email") @Expose private String email; @SerializedName("name") @Expose private

retrofit 2 404 not found

巧了我就是萌 提交于 2019-12-24 06:52:05
问题 I'm trying to use retrofit but i get 404 code and message "not found" Response {protocol=http/1.1, code=404, message=Not Found} i can see on my server log that the request was successfully and the response is and object I used to parsed it with Gson { "codigoRespuesta": "00", "descRespuesta": "Success", "token": "0bc6e8a352a002db5782ae729501fd05bd825cf165864a0ab32d1ab1529001ed2583df4a5ab257a30f97117ec0fec0b6df60adf288fd6b1579f31d2d636d9aa" } so I'm using the same object with retrofit that i

GSON throws Expected BEGIN_ARRAY but was BEGIN_OBJECT error [duplicate]

不羁的心 提交于 2019-12-24 06:34:55
问题 This question already has answers here : GSON throwing “Expected BEGIN_OBJECT but was BEGIN_ARRAY”? (5 answers) Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 (little edit) (5 answers) Closed 3 years ago . I am using retrofit and parse result with GSON. Don't know why but I receive this one Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path I know what this error mean but don't see the reason. This is my json response {"suggestions": [ { "value": "г Казань",

Android Retrofit GET @Query ArrayList

人走茶凉 提交于 2019-12-24 04:51:12
问题 I am trying to consume a GET API that expects in its query params list an array of strings. I am using Retrofit for the task. In the API interface, I have the following defined: @GET("user/explore") Observable<User> fetchUsers(@Query("who") String who, @Query("category") ArrayList<String> categories); I am using Timber for logging and in the console, I see the request is made like the following: http://192.168.2.208:3000/api/v1/user/explore?who=SOME_USER&category=SOME_CATEGORY The expected

Android Retrofit GET @Query ArrayList

青春壹個敷衍的年華 提交于 2019-12-24 04:51:04
问题 I am trying to consume a GET API that expects in its query params list an array of strings. I am using Retrofit for the task. In the API interface, I have the following defined: @GET("user/explore") Observable<User> fetchUsers(@Query("who") String who, @Query("category") ArrayList<String> categories); I am using Timber for logging and in the console, I see the request is made like the following: http://192.168.2.208:3000/api/v1/user/explore?who=SOME_USER&category=SOME_CATEGORY The expected

Retrofit method return wildcard

喜欢而已 提交于 2019-12-24 01:39:53
问题 I have an API response which is meant to generically return data for various activities of our application. In an effort to make the application as generic and flexible as possible we have setup an API to deliver a collection of URLs to utilize to create various rows on our activities. Our base object looks like: public class BaseApiObject { @SerializedName("apiVersion") private String apiVersion = null; @SerializedName("totalResults") private Integer totalResults = null; } Our response for

Retrofit Periodic call with Pagination

为君一笑 提交于 2019-12-24 01:15:08
问题 I am currently using the Retrofit2.0 to poll the server .I am getting the result in x second but the problem is page number is not updating in the API.Lets come to the code for better clarification private void startPolling() throws Exception { Log.e("APP CONSTANT","" + current_page); MrSaferWebService service = ServiceFactory.createRetrofitService(MrSaferWebService.class, AppConstants.BASE_URL); final Observable<ReportResponse> reportResponseObservable = service.getListOfInciden("get_report"

Unable to resolve Static method?

橙三吉。 提交于 2019-12-23 23:59:10
问题 I'm new to android and heard about retrofit . But when I tried to implement this, I'm getting this error: 11-07 10:57:59.969 8036-8291/com.example.first.servicefirst W/dalvikvm﹕ VFY: unable to find class referenced in signature (Ljava/nio/file/Path;) 11-07 10:57:59.969 8036-8291/com.example.first.servicefirst W/dalvikvm﹕ VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;) 11-07 10:57:59.969 8036-8291/com.example.first.servicefirst I/dalvikvm﹕ Could not find method

Why is Retrofit adding a trailing slash to all URLs?

♀尐吖头ヾ 提交于 2019-12-23 21:52:04
问题 Editing question with more details : I understand the use of service interfaces in Retrofit. I want to make a call to a URL like this : http://a.com/b/c (and later append query parameters using a service interface). My limitations are : I cannot use /b/c as a part of service interface (as path parameter). I need it as a part of base url. I have detailed the reason below. I cannot afford to have a resultant call being made to http://a.com/b/c/?key=val. What I need is http://a.com/b/c?key=val

How to pass JSON array inside body in retrofit

夙愿已清 提交于 2019-12-23 18:38:38
问题 { "intent":"sale", "redirect_urls":{ "return_url":"http://example.com/your_redirect_url.html", "cancel_url":"http://example.com/your_cancel_url.html" }, "payer":{ "payment_method":"paypal" }, "transactions":[ { "amount":{ "total":"7.47", "currency":"USD" } } ] } I want to pass following request in the body in retrofit.My problem is with json array which is being used as shown above.Can anyone tell how to pass this request in retrofit.Above is the json request which I want to pass in body of