O'Reilly logo

Learn Swift on the Mac: For OS X and iOS by Waqar Malik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    21

Consuming RESTful Services

If you have a Twitter account or a Facebook account, when you use their mobile applications you are consuming their services via a REST API.

Representational State Transfer (REST) defines an architecture, not a protocol, for designing Web services that consume system resources. It defines how the resource states are accessed and transferred over HTTP.

The key features of REST Web services are:

  • They use HTTP methods only.
  • They are stateless.
  • Endpoints are defined as directory structures.
  • Data is transferred using XML, JSON or both.

HTTP Methods

There are four HTTP methods, GET, PUT, POST and DELETE. These methods are defined by the HTTP protocol.

  • GET is used to retrieve a resource from the server.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required