Blockchain Nanodegree 预修知识之三:RESTful APIs(1)

Lesson 1: What’s and Why’s of APIs

What are APIs

APIs: Application Programming Interface

  • refer to any method of communication between two entities of code
  • connection points in code that allow one application to talk to another

Web API Protocols

Protocals: A set of rules for machines to speak the same language

OSI model: Open Systems Interconnection

Learn more about the OSI Model.

OSI Layers

Physical - Data Link - Network - Transport - Session - Presentation - Application (bottom to top)

  • A layer servers the layer above it, and is served by the layer below it
  • Protocols should be able to receive and hand off data for the protocols in the adjacent layers

Application layer protocols

HTTP, FTP, IMAP, SSH, POP, …

Two more layers: Web Service - Message Formatting

Web Service Layer

Simple Object Access Protocol (SOAP)

REpresentational State Transfer (REST): Use HTTP verbs

Message Formatting Layer

eXtensible Markup Language (XML)

JavaScript Object Notation (JSON)

REST Constraints

  1. Client-Server

    • Client sends requests to Server
    • Server sends response to Client
  2. Stateless

    • A stateful architecture remembers a client’s activity between requests
    • A truly RESTful architecture is not allowed to retain information about the state of another machine during the communication process
  3. Cacheable

    • Requests are labeled as cacheable or non-cacheable
  4. Uniform Interface

    • uniform between all clients and servers
  5. Layered system

    • a client can have access to an endpoint that relies on other endpoints without having to understand all of the underlying implementaions
    • Layering allows very complicated tasks to be completed without having to understand all of the underlying complexities that are required to generate the response.
  6. Code on Demand (optional)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值