1

I am developing an Android App. I read about RESTful Webservices and decided to use that for my app. But I have doubt about REST Client

After reading many article I understood that

  1. I can directly write code to make HTTP request from android App as given in Connenting To Network OR
  2. I can write code to develop the RESTful client OR
  3. I can use some already developed Third Party lib like RESTDroid

I am not able to decide should directly write code to make the HTTP request as suggested by developers guide or i should follow the rest client model.

What is the advantage of using rest client over directly making HTTP request ( or can say using non-RESTful Client) ?

I am new to android and REST architecture. Please correct me if I am wrong.

Abhishek Gupta
  • 1,173
  • 4
  • 12
  • 26
  • You better first tell what kind of server you have of would like to have. You use a webserver with php? Then all you have to do is making direct connections using HttpUrlConnection for example. In my opinion there is no such thing as a restfull client or non restfull client. You just need a client for your php script. You connect and post or get some parameters using http protocol. Thats all. – greenapps Jan 07 '17 at 11:56
  • @greenapps Thanks for suggestions. Actually I am planning to use the webservice which provides rest api ( from https://apispark.restlet.com/) I actually I am getting confused by term "REST client" which is present on many post. See this question. http://stackoverflow.com/questions/8267928/android-rest-client-sample Top answer list many of such REST client. I understood you can have RESTful web api but normal direct connection. I could not understand what is use of RESTful client here. – Abhishek Gupta Jan 07 '17 at 12:31
  • Sorry, i will not follow those links. – greenapps Jan 07 '17 at 21:49

1 Answers1

0

This is quite a broad answer but I will divide it in 2 parts:

1) Rest and non-Rest clients:

In my experience I have not seen any REST client except the browsers

the industry trimmed part of the original REST specification and created improved HTTP clients/services and called them REST which(most of them) are not different than any ordinary HTTP library.

So for Android you will get ordinary HTTP Clients with various features but the REST part you will need to code it yourself.

2) What is better to use

Clearly I would not advise to write your own HTTP client as it is far from trivial job to do.

I would not advise to use Retrofit for a really RESTful service as it is not good for that. You better build something on top of OkHttp or extend Volley or Jus which is my creation and it will support basic HATEOAS implementations from version 0.7.0 and optimized pipeline and memory utilization from version 1.0.0 (follow it on github :)

kalin
  • 3,546
  • 2
  • 25
  • 31