API 是什麼? RESTful API 又是什麼?

????????????

2xx = Success????3xx = Redirect?????4xx = User error???????5xx = Server error????????

? HTTP ??????? method ???????????????????GET / POST / PUT / DELETE?????????????? CRUD ?????

CRUD ? Create(??)?Read(??)?Update(??)?Delete(??)???

? RESTful API ?????

?????????

  1. Nouns ?????????? URL??????????????????????????????????
  2. Verbs ????????????
  3. Content Types ???????API ????????????????? JSON??????????

??? API????????

????GET /getData????POST /createData????DELETE /deleteData/1

????????????????????????????????????????? API ??????? API ????????????????????

?? RESTful API ???????

????GET /data????POST /data????DELETE /data/1

???????? URL ?????????? HTTP ? method ???

???? RESTful ????? API??????????????

1. ????URL?????????? API ???(Uniform Interface)

2. ????(Stateless)

RESTful ?????? HTTP ???????? Web ????Server ?? Client ?????????? Server ?? Session (????????)?? Client ???????????Server ?????? Server ?? Session???? request????????? Client ??????????? Server ????????? Server ??Server ???? Client ???????

????????????????Server ?? token ?? user ????????? token ?? Client?? Client ??????????? token ???? Server??? Server ?????? Client ???????????

?????????? URI ????????????????????????????????????????????

????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????????????URL??????????????????????????????????????????????????????????????? URL ???????? HTTP ?? GET ????????????? RESTful ???

3. ??????????????? (Cachable)

? server-side?GET ?????????????????? cache ???? request?? client-side??? client ? cache ?? chahe ????? server ??????? server ???? cache ???? client ?????????????????????

4. ?????? (Layered System)

5. ???????? (Client-Server)

6. ???? HTTP protocal(GET/POST/PUT/DELETE) (Manipulation of resources through representations)

7. ???????????? JavaScript????????? Code-On-Demand (optional)

?????https://zh.wikipedia.org/wiki/%E8%A1%A8%E7%8E%B0%E5%B1%82%E7%8A%B6%E6%80%81%E8%BD%AC%E6%8D%A2https://tw.alphacamp.co/blog/2016-10-25-coding-basics-for-marketers-1https://ithelp.ithome.com.tw/articles/10157431https://www.itread01.com/content/1544242329.htmlhttps://progressbar.tw/posts/53https://blog.csdn.net/hjc1984117/article/details/77334616https://www.zhihu.com/question/28557115https://blog.csdn.net/hjc1984117/article/details/77334616http://www.ruanyifeng.com/blog/2011/09/restful.htmlhttps://blog.toright.com/posts/5523/restful-api-%E8%A8%AD%E8%A8%88%E6%BA%96%E5%89%87%E8%88%87%E5%AF%A6%E5%8B%99%E7%B6%93%E9%A9%97.html https://blog.csdn.net/Jmilk/article/details/50461577 https://blog.csdn.net/matthew_zhang/article/details/63410421

?????????????????? ?