28
Introduction to Computing FPT UNIVERSITY (HCMC – Vietnam) Class: IA1161

[CSI101] - RESTful Presentation in Introduction to Computing

Embed Size (px)

Citation preview

Introduction to Computing

FPT UNIVERSITY (HCMC –Vietnam)

Class: IA1161

Basic aboutRESTful Web Service

Feb 24th, 2016

Duc Lai Trung Minh

[email protected]

ABOUT MEName: Duc Lai Trung Minh

English name: Henry Lai

Email: [email protected]

Website: http://minhduclaitrung.wordpress.com

LinkedIn: https://vn.linkedin.com/in/duclaitrungminh

The Content Is Written In Vietnamese

NỘI DUNG

• Định nghĩa RESTful Web Service

• Định nghĩa URLs

• Phương thức HTTP thực hiện CRUD

• Nguyên tắc sử dụng

• Mô hình thiết kế đề xuất

• DEMO

• Hỏi/ Đáp

• Nguồn tham khảo

• Phụ lục

ĐỊNH NGHĨA REST

• Quy tắc thiết kế Web Service trên Server

• Bằng cách xây dựng các URLs

• Cho các thao tác CRUD ( Create – Read – Update – Delete)

• Thông qua các giao thức HTTP (HTTP Request Method)

• (Có thể trả về dữ liệu dạng JSON/ XML)

ĐỊNH NGHĨA URL

• https://minhduclaitrung.wordpress.com/2015/12/12

/ky-3-tao-website-wordpress-tren-nen-tang-

microsoft-azure/

• https://minhduclaitrung.wordpress.com/year/mo

nth/day/title

HTTP Request Method cho REST

• POST

• GET

• PUT

• DELETE

Tạo tài nguyên

Truy xuất tài nguyên

Cập nhật tài nguyên

Xóa tài nguyên

Source: IBM.com

• CREATE

• READ

• UPDATE

• DELETE

NGUYÊN TẮC XÂY DỰNG

• Sử dụng một ngôn ngữ lập trình chạy trên Server (PHP,

ASP.NET, Java,…) để tiếp nhận và phản hồi truy xuất từ

Clients.

• Kết hợp với hệ cơ sở dữ liệu (MySQL, MongoDB, SQL

Server, Redis,…) để xử lý tài nguyên.

MÔ HÌNH ĐỀ XUẤT

HTTP

RequestPath Method Ý nghĩa

GET / index Lấy tất cả ticket

GET /create create Vô trang tạo ticket

POST /ticket store Tạo ticket

GET /ticketid show Xem thông tin ticket tại ticketID

GET /ticketid/edit editVô trang sửa thông tin ticket tại

ticketID

PUT /ticketid update Sửa thông tin ticket có ticketID

DELETE /ticketid destroy Xóa ticket

Source: Laravel.com

Adapted by: DucLTM

DEMO- RESTfu l API: http://ducltmse62220.azurewebsites.net/TicketI2C/API

- Website: http://ducltmse62220.azurewebsites.net/TicketI2C/WEB

- Language: PHP 5.6

- Database: MySQL

- Server: Microsoft Azure

- API Tester: Postman on Chrome

- Terminated Site date: March 8th, 2016

WEBSITEFor More Detail About How This Site Works, Please Check Out

https://www.laravel.com

GET: /

GET: /create

POST: /

GET: /ticketid

GET: /ticketid/edit

PUT: /ticketid

DELETE: /ticketid

API

GET: /

POST: /

GET: /ticketid

PUT: /ticketid

DELETE: /ticketid

REFERENCE

• URL/ URI: https://danielmiessler.com/study/url-uri/

• IBM RESTful Web Service:

http://www.ibm.com/developerworks/library/ws-

restful/

• Laravel: https://laravel.com

Q/AName: Duc Lai Trung Minh

English name: Henry Lai

Email: [email protected]

Website: http://minhduclaitrung.wordpress.com

LinkedIn: https://vn.linkedin.com/in/duclaitrungminh

THANK YOU