Web Programming/Web Services

Web Services edit

Concepts and examples: https://www.youtube.com/watch?v=7YcW25PHnAA

Find available web service APIs at http://www.programmableweb.com/

Testing Tools edit

Postman - REST client (Chrome app)

apigee.com/console/

RESTful API edit

source: http://www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069

REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications. A service based on REST is called a RESTful service. RESTful services should have following properties and features:

Representations edit

RESTful service provides access to these resources, which must represented using a format such as JSON.

Messages edit

The client and service talk to each other via messages. In addition to the message body messages contain metadata such as header - key-value pairs.

Addressing resources edit

REST requires each resource to have at least one URI. A RESTful service uses a directory hierarchy like human readable URIs to address its resources. URI should not say anything about the operation or action, which is determined by the HTTP verb.

Uniform interface edit

RESTful systems should have a uniform interface. HTTP 1.1 provides a set of methods, called verbs (GET, PUT, POST, DELETE, OPTIONS, HEAD), for this purpose. A Safe HTTP method does not make any changes to the resource on the server. An Idempotent HTTP method has same effect no matter how many times it is performed.

Stateless edit

A RESTful service is stateless and does not maintain the application state for any client. A request cannot be dependent on a past request and a service treats each request independently.

Links between resources edit

A resource representation can contain links to other resources like an HTML page contains links to other pages.

Caching edit

Caching is the concept of storing the generated results and using the stored results instead of generating them repeatedly if the same request arrives in the near future. This can be done on the client, the server, or on any other component between them, such as a proxy server.

Documenting a RESTful service edit

A client can simply know the base address of the service and from there it can discover the service on its own by traversing through the resources using links. The method OPTION can be used effectively in the process of discovering a service. Sample documentation of a service can be found at http://www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069?pgno=3