7

I need to create an application that dialogues with a REST server.

I found that answer: Android REST client, Sample? but it's of 2012.

Is there a tutorial that I can follow (and that you suggest) in order to obtain a little working sample project? Thanks in advance.

Community
  • 1
  • 1
helloimyourmind
  • 994
  • 4
  • 14
  • 30

2 Answers2

7

All you need is here. https://square.github.io/retrofit/ Its easy to use and you almost dont have to care about json deserialization

Sebastian Pakieła
  • 2,970
  • 1
  • 16
  • 24
  • You can try this one: http://blog.robinchutaux.com/blog/a-smart-way-to-use-retrofit/ restAdapter and interface are basics of it so focus on it. – Sebastian Pakieła Jul 01 '15 at 23:22
  • As I said, I'm a newbie in this kind of thing. I'm trying since this morning, but I'm not able to get data. I followed this tutorial: http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-23/ and now I have a working server and I can do REST call by Chrome Extension, but how to do a call like this: http://localhost/task_manager/v1/login email, password – helloimyourmind Jul 02 '15 at 18:53
  • If you can make requests in chrome extension, then its half work done :P Now you need to create retrofit restadapter, set endpoint to localhost with using method .setEndpoint("localhost") (You may need to pass ip number instead of localhost). Create api interface and write request structure. In you case it will look like public interface ApiService { @POST("/task_manager/v1/login") public ClassForLoginResponse login(@Query("email")); } and set the interface in adapter. – Sebastian Pakieła Jul 02 '15 at 19:17
  • Can u please provide me further details? – helloimyourmind Jul 02 '15 at 20:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/82237/discussion-between-helloimyourmind-and-404notfound). – helloimyourmind Jul 02 '15 at 21:03
2

Try out a Library called Volley which was demoed in Google I/O 2013

N Jay
  • 1,774
  • 1
  • 17
  • 36