Introduction to RESTful Clients

BTI360 Blog / August 4, 2010 in 

In this blog we are going to take a look at clients of RESTful Web Services. RESTful Web Service clients are programs or libraries that can be used to consume RESTful Web Services. These clients are responsible for making the underlying HTTP requests to a RESTful Web Service. Every modern programming language has one or more libraries for making HTTP requests and each client will usually use one of these libraries.

To build a RESTful Web Service client you will need an HTTP library with at least these features:

  • Supports GET, POST, PUT, and DELETE requests: These four http methods are required when creating and modifying resources.
  • Supports adding and modifying request headers: Specific request header values need to be used to specify the representation of the resource (json, xml, jpg, etc).
  • Allows the programmer to customize the data sent as the entity-body of a PUT or POST request: This means that the programmer can include any data they want in any representation they choose as the body of the request.
  • Allows the programmer access to the response code and headers: The programmer needs access to the response code to determine if the request was processed successfully or if any error conditions exist. Access to the header is used to determine the representation of the resource in the response body.
  • Supports HTTPS and SSL certificate validation: This ties in with security as many RESTful Web Services and http servers in general will require the client to support secure communication.

Example Libraries

Some example libraries that support these features are as follows:

  • Java: Spring’s Rest Template, Apache HttpClient
  • Ruby: ActiveResource
  • Javascript: Many solutions (XMLHttpRequest, ExtJs, jQuery, Dojo, Prototype, etc)
  • C++: Curl
  • .NET: HttpWebRequest and HttpWebResponse

Once you have an acceptable HTTP library, you will need another library or piece of code to convert your resource into the chosen representation and vice-versa. The most common representations currently used in RESTful Web Services are XML and JSON.

In our next blog post we will take a closer look at some of the libraries programmers use in their RESTful Web Service clients and dig into some examples.

Previous

Summary: RESTful Web Services with Spring

Next

Building a RESTful client with Spring’s RestTemplate

Close Form

Enjoy our Blog?

Then stay up-to-date with our latest posts delivered right to your inbox.

  • This field is for validation purposes and should be left unchanged.

Or catch us on social media

Stay in Touch

Whether we’re honing our craft, hanging out with our team, or volunteering in the community, we invite you to keep tabs on us.

  • This field is for validation purposes and should be left unchanged.