Backendless Support
 
Cannot answer

How to search with where clause with retrof

I'm currently using retrofit and I'm trying to get Data Object from DB.

Here is my code:

  1. @GET("data/Users?where=")
  2. Call<User> getUserByLogin(@Query(value = "login", encoded = true) String login);

Test

  1. @Test
  2. public void testApiGetUsernameByLogin() throws Exception {
  3. Retrofit backendlessRetrofit = new Retrofit.Builder()
  4. .baseUrl(BASE_URL)
  5. .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
  6. .addConverterFactory(GsonConverterFactory.create())
  7. .build();
  8. BackendlessAPI backendlessAPI = backendlessRetrofit.create(BackendlessAPI.class);
  9. System.out.println(backendlessAPI.getUserByLogin("timuruktus").execute().body());
  10. }

POJO which I'm trying to retrieve

  1. public class User {
  2. private String login;
  3. private String vkId;
  4. private String name;
  5. private String objectId;
  6. public User() {
  7. }
  8. public User(String login, String vkId, String name, String objectId) {
  9. this.login = login;
  10. this.vkId = vkId;
  11. this.name = name;
  12. this.objectId = objectId;
  13. }
  14. public String getLogin() {
  15. return login;
  16. }
  17. public void setLogin(String login) {
  18. this.login = login;
  19. }
  20. public String getVkId() {
  21. return vkId;
  22. }
  23. public void setVkId(String vkId) {
  24. this.vkId = vkId;
  25. }
  26. public String getName() {
  27. return name;
  28. }
  29. public void setName(String name) {
  30. this.name = name;
  31. }
  32. public String getObjectId() {
  33. return objectId;
  34. }
  35. public void setObjectId(String objectId) {
  36. this.objectId = objectId;
  37. }
  38. }

Info from console:

  1. null
  2. Process finished with exit code 0

I tried this using getUserByLogin method without "?where=", I tried with @Path annotation and nothing changed

Leave a Comment

Comments (1)

photo
1

Hi,

we can't provide support for problems related to using Backendless with third-part libraries.

Regards,

Stanislaw