HTTP & Async Flashcards
The HTTP Acronymn stands for what?
HyperText Transfer Protocol
(designed to retreive information)
What is HTTP?
It’s a “message” that you are sending to a server.
Every HTTP “message” is called what?
Every HTTP “message” is called a
REQUEST
Every HTTP “reply” is called what?
Every HTTP “reply” is called a RESPONSE
The Anatomy of an HTTP request contains?
URL: https://google.com/apis/test
Method: GET, POST, PUT, PATCH, DELETE…
Headers: Authentication, cookies, Content-Type
Payload: data or empty
What is the endpoint address we’re reaching out for and it starts with HTTP or HTTPS?
URL
Uniform Resource Locator
What tells the endpoint the purpose of our request?
Method
The most commonly used HTTP methods in modern API’s are:
GET: I want some information
POST: I’m sending some information
PUT: I want to edit something
DELETE: I want to delete something
What specifies some extra information about our Request?
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?
What is sent only on POST (create) and PUT (edit ) request and is also known as the body of the request?
Payload
What is the 3 digit integer which indicates whether a request has been gone successfully or not?
Status Code
A 201 HTTP status code stands for what?
Status Code: 201 means:
Created
tells us the result of the operation
A 500 HTTP status code stands for what?
Status Code: 500 means:
INTERNAL SERVER ERROR
something wrong, server side
A 404 HTTP status code stands for what?
Status Code: 404 means:
NOT FOUND
cannot find the info you’re looking for
A 401 HTTP status code stands for what?
Status Code: 401 means:
UNAUTHORIZED
you are not authorized
A 400 HTTP status code stands for what?
Status Code: 400 means:
BAD REQUEST
there is something wrong with your request
A 200 HTTP status code stands for what?
Status Code: 200 means:
OK
contains the information requested by the request
A JSON stands for?
JavaScript Object Notation:
it’s a data structure often used as an interchange format in http requests and responses.
What function is used to turn an Object or an Array into a JSON file?
JSON.stringify

In Javascript we handle Async code in 3 ways namely:
Callbacks
Promises
Async/await patterns
What does a Promise represent?
The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.

A Promise can be in one of the following states:
Pending: still waiting
Fulfilled: value available
Rejected: an error happened
What is a Callback function?
A Callback function is a function parsed into another function.