---
# System prepended metadata

title: '02.1-WebServic and APIs-Lesson1: Overview'
tags: [Udacity]

---

# 02.1-WebServic and APIs-Lesson1: Overview
###### tags: `Udacity`

# 01 Instructor Introduction
{%youtube NWTxxfy_uN8%}

# 02 Course Intro
{%youtube 9sNj7tGyiSQ%}

==ShannonNote==
> WebServices, API, Microservices可以分享data在不同的系統中

# 03 Web Services & APIs Overview
{%youtube oAQJbdT1uaY%}

# 04 Web Services
**What is a Web Service?**
{%youtube 1EELvkp3UX0%}
A web service is a way to share data between two disparate systems. The communication typically happens between a client and a server.
* Client - The client makes a request for data.
* Server - The server responds to the client's request.
**Web Service Communication**
{%youtube OvWyj9R-Ab8%}

The means of communication between the client and server is via a standard web protocol like HTTP (or HTTPS) on the world wide web, that uses a common language like JSON or XML.

A client invokes a web service by sending an XML (or JSON) message, then waits for a corresponding XML response from the server.

**How Web Services Work**
{%youtube oSZjVTwQQmc%}
How Web Services Work

Step 1: The web service provider (the person who created the web service) defines a standard format for requests and also for the responses provided.

Step 2: The client sends a request to the web service across the network.

Step 3: The web service receives the request and performs an action (like query a database or perform a calculation) and sends a response back to the calling client.

==ShannonNote==
> * WebService
	* 是一種在不同系統分享資訊的方式
	* 又或是一種可以方式說讓你可以取得數據來呈現在你的application上面
	* 他不能直接跟用戶拿資料，但她可以讓兩個系統間無縫聯繫
	* Client跟Server端透過標準protocal(HTTPS)來傳遞JSON或XML來做溝通
	* A client會使用web service來寄送XML or JSON訊息，然後經過等待之後收到Server回應的XML。
> * WebService 如何運作?
	* 1. 那個創造webService的人去定義一個標準格式for requests and response provided
	* 2. client會製造出一個request of the web service across the network.
	* 3. 最後 webService 接收到Client傳過來的request然後執行某些action, 再回傳response
>
>![](https://i.imgur.com/J5c6Q7R.png)


# 05 Benifits of Web Services
{%youtube XXv_D0aBjrU%}

==ShannonNote==
>* WebService有提供可以重複複寫的code
	* 因此如果要在很多個application使用相同的Data, WebService就會很方便

# 06 Web Services vs APIs vs Microservices
{%youtube 70g1Fn2AZpg%}

Publicly Accessible API
A list of publicly accessible APIs: https://github.com/public-apis/public-apis/blob/master/README.md.

==ShannonNote==
> * API可以在不同系統間分享資料跟WebService很像
	* 但他更Dynamic, lightweight, streamlined
> * 所有的webService都是APIs, 但不是所有的APIs都是web Service
> * microservice(比APIs, WebService更晚出現)
	* 他是很多個小小的原件Service, 有特定的business define
	* (下圖)簡單來說我可以製作一個專門放置location的微型Serivce, 他的Database也只包含location相關資訊
	* ![](https://i.imgur.com/OWQAMos.png)

# 07 Web Service Demo
{%youtube uKfGF76arek%}

==ShannonNote==
> 使用Postman, 他可以協助你測試APIs

# 08 Spring Initializr
![](https://i.imgur.com/nTbKSBl.png)

Spring Initializr will help you easily use Spring boot

We will use [Spring Boot](https://spring.io/projects/spring-boot) throughout this course to more easily deploy web services and APIs with Java.

[Spring Initializr](https://start.spring.io/) is a tool that quickly generates the base code needed for a Spring Boot project including dependencies. The tool can be accessed from a web browser or from within your Integrated Development Environment (IDE). For example, IntelliJ provides Spring Initializr instructions here. If you haven't already, you should check this tool out before we get deeper into the course.

# 09 Lab: Test an API
**Labs**
The labs included throughout this course are your chance to get hands-on experience with web services and APIs before the project. They are crucial to absorbing the content and making sure you succeed on the project at the end of the course. Make sure to take advantage of the support options available to you if needed to get through them!

*Labs will help drive your success in the course!*
![](https://i.imgur.com/1uk3yl7.png)


Lab: Test an API
The goal of this lab is to use Postman to test a publicly accessible API.
* Step 1: Download and install Postman:
	* Navigate to https://www.getpostman.com/
	* Click “Get Started”
	* Click “Download” - ensure you’re downloading the correct version for your OS
* Step 2: Open Postman
* Step 3: Test one of the publicly accessible APIs found [here](https://github.com/public-apis/public-apis/blob/master/README.md) in Postman by pasting the URL in the text box on the right hand slide
* Step 4: Click on “Send”
* Step 5: Review the output - does it meet your expectations based on the API's documentation?

# 10 Recap
{%youtube esqHIYPSbA0%}