HTTP & Async Flashcards

1
Q

The HTTP Acronymn stands for what?

A

HyperText Transfer Protocol

(designed to retreive information)

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

What is HTTP?

A

It’s a “message” that you are sending to a server.

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

Every HTTP “message” is called what?

A

Every HTTP “message” is called a

REQUEST

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

Every HTTP “reply” is called what?

A

Every HTTP “reply” is called a RESPONSE

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

The Anatomy of an HTTP request contains?

A

URL: https://google.com/apis/test

Method: GET, POST, PUT, PATCH, DELETE…

Headers: Authentication, cookies, Content-Type

Payload: data or empty

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

What is the endpoint address we’re reaching out for and it starts with HTTP or HTTPS?

A

URL

Uniform Resource Locator

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

What tells the endpoint the purpose of our request?

A

Method

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

The most commonly used HTTP methods in modern API’s are:

A

GET: I want some information

POST: I’m sending some information

PUT: I want to edit something

DELETE: I want to delete something

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

What specifies some extra information about our Request?

A

Headers

eg:

  • Content-Type:* I’m sending data in JSON format
  • Authorization:* This is my key to authorize me
  • Accept:* I expect to receive back some JSON data
  • Cookie* Want some cookie?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is sent only on POST (create) and PUT (edit ) request and is also known as the body of the request?

A

Payload

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

What is the 3 digit integer which indicates whether a request has been gone successfully or not?

A

Status Code

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

A 201 HTTP status code stands for what?

A

Status Code: 201 means:

Created

tells us the result of the operation

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

A 500 HTTP status code stands for what?

A

Status Code: 500 means:

INTERNAL SERVER ERROR

something wrong, server side

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

A 404 HTTP status code stands for what?

A

Status Code: 404 means:

NOT FOUND

cannot find the info you’re looking for

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

A 401 HTTP status code stands for what?

A

Status Code: 401 means:

UNAUTHORIZED

you are not authorized

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

A 400 HTTP status code stands for what?

A

Status Code: 400 means:

BAD REQUEST

there is something wrong with your request

17
Q

A 200 HTTP status code stands for what?

A

Status Code: 200 means:

OK

contains the information requested by the request

18
Q

A JSON stands for?

A

JavaScript Object Notation:

it’s a data structure often used as an interchange format in http requests and responses.

19
Q

What function is used to turn an Object or an Array into a JSON file?

A

JSON.stringify

20
Q

In Javascript we handle Async code in 3 ways namely:

A

Callbacks

Promises

Async/await patterns

21
Q

What does a Promise represent?

A

The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.

22
Q

A Promise can be in one of the following states:

A

Pending: still waiting

Fulfilled: value available

Rejected: an error happened

23
Q

What is a Callback function?

A

A Callback function is a function parsed into another function.