Rest & WebApi

  • View
    149

  • Download
    0

Embed Size (px)

Text of Rest & WebApi

PowerPoint Presentation

RESTfulAuthor:

TU TranSkype: tranthanhtu83

1

OverviewActions (Verbs)OutputConstraintsQ&AAgenda

TU Tran

2

REST stands for Representational State TransferOverview

TU Tran

3

Overview

TU Tran

Was used as the interface between client and serverSaperated concern: client care how to display data, server cares how to save data4

Actions (Verbs)

TU TranGet list of resourceGet detail of resourceCreate new resourceUpdate of resourceDelete a resource

5

Actions/ Get

TU Tran

6

Actions/ Create

TU Tran

7

Actions/ Update

TU Tran

8

Actions/ Delete

TU Tran

9

Output

TU TranJSONXMLCSV

Specify what client expect to receive format of dataSome client can handle well on json, some other can handle well on xml10

Output

TU TranUse header requestAccept: application/jsonUse query stringGet http://localhost/user.jsonUse file extensionGet http://localhost/user.json

Common ways11

Constraints

TU TranClient ServerUniform InterfaceStatelessCacheableLayered SystemCode on Demand (optional)

12

Constraints / Client - Server

TU Tran

13

- Get detail of #4 user: ../api/users/4

- Get detail of #2 category: ../api/categories/2Constraints / Uniform Interface

TU Tran

14

The request must be independent each otherEasy to add more servers if needConstraints / Stateless

TU Tran

15

Constraints / Cacheable

TU TranAvoiding unnecessary processing Significantly increasing performance

Any commit will trigger process to check and report the resultShould make it automate16

Constraints / Layered System

TU Tran

This structure is much more flexible to change

Should make it automate17

TU TranQ&A

Set the same target to end user- High-quality software, Faster releases, and Improved customer satisfaction who usually expects fast and stable featuresImproved deploy frequency which can lead to faster time to marketLower failure rateShortened lead timeFaster mean time to recovery

18

THANK YOU

TU Tran

19