9
Web API HOW TO TALK TO THE WEB

Website RESTful APIs

Embed Size (px)

Citation preview

Page 1: Website RESTful APIs

Web APIHOW TO TALK TO THE WEB

Page 2: Website RESTful APIs

What is Web API Type of application programming interface (API)

Client and server based

Content focused

Processed through HTTP Requests and Responses (Most commonly)

Page 3: Website RESTful APIs

Diagram

Page 4: Website RESTful APIs

Representational State Transfer (REST)

Architecture for coordinated set of constraints for HTTP transfers

POST GET

PUT DELETE

Page 5: Website RESTful APIs

RESTful Constraints Client–server – Separate UI from Server functions

Stateless – Each request has all the needed data

Cacheable – implicitly or explicitly, define as cacheable

Layered system – client does not depend on end server connection

Uniform interface – uniform interface simplifies and decouples the architecture

Page 6: Website RESTful APIs

Why Web API Allows for a scalable, decoupled development of a Web Service.

Can easily be shared and used by other developers to access your web service.

It is Used to build simple, non-SOAP-based HTTP Services on top of existing WCF message pipeline.

It doesn't have tedious and extensive configuration like WCF REST service.

It is only based on HTTP and easy to define, expose and consume in a REST-ful way.

It is light weight architecture and good for devices which have limited bandwidth like smart phones.

It is open source.

Page 7: Website RESTful APIs

Web API vs WCFWCF Web API

Transport protocols (HTTP, TCP, UDP,..)

HTTP only. More suitable for access from various devices

Encodings (Text, MTOM, and Binary)

wide variety of media types including XML, JSON etc.

WS-* standards like Reliable Messaging, Transactions, Message Security.

There is no support for higher level protocols such as Reliable Messaging or Transactions.

Supports Request-Reply, One Way, and Duplex message exchange patterns.

HTTP is request/response

Page 8: Website RESTful APIs

Web API tools ASP.NET Web API

Swagger

Django

Page 9: Website RESTful APIs

Demo