2.0 Understanding and Using APIs Flashcards

1
Q

2.1: what are 5 common HTTP request methods

A

Get
Post
Put (U for update)
Delete
Patch (A for append)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

2.4: Response codes: 100’s

A

Informational

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

2.4: Response codes: 300’s

A

Redirect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

2.4: Response codes: 200’s

A

Success

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

2.4: Response codes: 500’s

A

Server Errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

2.4: Response codes: 400’s

A

Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

2.4 Response code 403

A

You are not authorized to view this page (HTTP Error 403 - Forbidden)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

2.4: Response code 404

A

The page cannot be found (HTTP Error 404 - File not found)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

2.4: Response code 429

A

The HTTP return code of 429 indicates that the user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

2.1: what is the difference between PUT, POST, and PATCH

A

POST - Submits data to a specific destination
PUT - Replaces completly data at a specific destination
PATCH -makes a partial update on a resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

2.2 Describe common usage patterns related to webhooks

A

Webhooks set up on a host to push data to an API when certain events trigger it.

Example: At certain points in an Amazon order the webhooks will send data to the customer portal API to update order status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

2.3 Identify the 6 constraints when consuming APIs (REST)

A
  1. Client-Server
  2. Stateless
  3. Cache
  4. Uniform Interface
  5. Layered System
  6. Code-On-Demand (optional)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

2.3: What does the REST API restraint “Stateless” mean?

A

The server will not store anything about the last HTTP request from a client. Each request will be treated as new.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

2.3: What does the REST API restraint “Uniform Interface” mean?

A

ses the same protocols all the time. Always HTTPS or only HTTP for example.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

2.6 Identify the parts of an HTTP response: response code

A

The code is located in the first lines, optionally it will have text beside it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

2.6 Identify the parts of an HTTP response: headers

A

These are all Key:Value Pairs

17
Q

2.6 Identify the parts of an HTTP response: body

A

Located after the headers. The body contains the payload. There is a blank line in between the headers and the body.

18
Q

2.7 Utilize common API authentication mechanisms: API keys

A

An API key is a predetermined string that is passed from the client to the server. Anyone with this key can access the API in question.

19
Q

2.7: What are the three different ways to pass API keys?

A

String-Based: You add ?examplekey123 to each API calls URI.

Request header: In the header you define the key. Example: X-API-Key: abcdef1234

Cookies: same as a Request header besides the name of the key. Example: Cookie: abcdef1234

20
Q

2.7 Utilize common API authentication mechanisms: Basic

A

Basic calls for username password base 64 encoded and is not secure by default, use https with it to assist. Password is sent back and forth with each request.

21
Q

2.7 Utilize common API authentication mechanisms: custom token

A

The user authenticates once, the server authenticates and then sends a cryptologically signed token back to the user (JWT in most cases) and then the user can use the token to authenticate from then on.

22
Q

2.7 What is a JWT and what two componets is it comprised of?

A

JavaScript Web Tokens are the most popular form of token used today.

JWT = {JSON} + Cryptologic Signature

23
Q

2.8 Compare common API styles REST

A
  1. Uniform Interface - Example: all calls have to use same tech, ie HTTP only or HTTPS
  2. Client-Server: The client and server cannot be on the same software, they need to be separate applications even if on the same computer.
  3. Statelessness: Every API call has to contain everything required to complete the requested operation
24
Q

2.8 Compare common API styles RPC

A

RPC is a protocol that allows a program to execute code on a remote server as if it were a local procedure call. Unlike REST, which operates on resources, RPC emphasizes direct function calls, making it simpler for specific tasks but potentially less scalable for large systems.

25
2.8 Compare common API styles synchronous
A synchronous API requires the client to wait for the server to process a request and return a response, leading to blocking behavior. This approach is straightforward and easier to implement, but it can result in delays.
26
27
2.8 Compare common API styles asynchronous
An asynchronous API enables the client to send a request and continue processing without waiting for a response, promoting non-blocking behavior. This is beneficial for performance and user experience, particularly in high-load scenarios, and sets it apart from synchronous APIs, which can hinder responsiveness.