It is necessary to obtain 1 copy of the object from the database in Backendless via Retrofit. Search by primary key (login)
The interface of the retrofit is described as follows:
BackendlessAPI.java
@GET("data/Users?where") Call<User> getUserByLogin(@Query(value = "login", encoded = true) String login); I am trying to test the method:
@Test public void testApiGetUsernameByLogin() throws Exception { Retrofit backendlessRetrofit = new Retrofit.Builder() .baseUrl(BASE_URL) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); BackendlessAPI backendlessAPI = backendlessRetrofit.create(BackendlessAPI.class); System.out.println(backendlessAPI.getUserByLogin("timuruktus").execute().body()) }; The console issues this:
null Process finished with exit code 0 Here is the documentation from Backendless: https://backendless.com/docs/rest/doc.html#data_search_with_where_clause
DB Example
POJO object:
User.java
public class User { private String login; private String vkId; private String name; private String objectId; public User() { } public User(String login, String vkId, String name, String objectId) { this.login = login; this.vkId = vkId; this.name = name; this.objectId = objectId; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getVkId() { return vkId; } public void setVkId(String vkId) { this.vkId = vkId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getObjectId() { return objectId; } public void setObjectId(String objectId) { this.objectId = objectId; } } More details of their console:
Response{protocol=http/1.1, code=400, message=Bad Request, url=https://api.backendless.com/****/*****/data/Users?where=&login=timuruktus} It turns out that after where= is an ampersand, but it is not needed there! How can I remove an ampersand using Query annotation?
