Using APIs Flashcards
Use cases for APIs: (3)
- Automation tasks
- Data integration
- Functionality
Why are APIs so popular? (4)
- Apps were locked down
- The demand for integration has grown and more apps are exposing APIs.
- Modern APIs are designed as part of the product and even used as part of the product.
- The demand for APIs has made simple languages use these APIs and means non-software engineers can build apps and get results they need.
Name two types of APIs and the difference?
Synchronous API - Response and data is provided directly
Asynchronous API - Provides an initial response, but client needs to “call back” to obtain the data
Name 3 architectural styles of API calls
RPC
REST
SOAP
RPC implementation types
○ XML-RPC
○ JSON-RPC
○ NFS
○ Simple Object Access Protocol (SOAP)
What data format does SOAP support?
XML
Name the elements of SOAP message ? (4)
Envelope
Header
Body
Fault
Name 6 REST Constraints to be RESTful
Client-Server Stateless Cache Uniform Interface Layered System Code-on-demand
Name 4 components of REST API
URI
HTTP Method
HEADER
BODY
Name the 5 types of status codes and their meaning (high level)
1xx Informational 2xx Success 3xx Redirection 4xx Client Error 5xx Server error
HTTP Status CODE - OK
200
HTTP Status CODE - Created
201
HTTP Status CODE - Bad Request
400
HTTP Status CODE - Forbidden
403
HTTP Status CODE - Unauthorized
401
HTTP Status CODE - Not Found
404
HTTP Status CODE - Internal Error
500
HTTP Status CODE - Service Unavailable
503
HTTP Status CODE - Not implemented
501
REST Authentication Methods
Basic Authentication
Bearer Authentication (token)
API Key
What method of authentication does OAuth use
Token like bearer Authentication
Why use API rate limits? (3)
- Avoiding server overload
- Provide better response times
- Protect against Dos attacks
List 4 API rate limit algorithms
Leaky bucket
Token bucket
Fixed window counter
Sliding Window Counter
API Rate limit - explain X-RateLimit-Limit header
the max number of request per unit of time
API Rate limit - explain X-RateLimit-Remaining header
the number of requests remaining in that unit of time
API Rate limit - explain X-RateLimit-Reset header
the time the limit will reset
What is a webhook?
Also called reverse API
Its an HTTP callback or HTTP Post
HTTP Status CODE - Method not allowed
405
HTTP Status CODE - Bad Gateway
502
HTTP Status CODE - Gateway timeout
504
HTTP Status CODE - No content
204