Created
April 29, 2019 23:34
-
-
Save Alacrity01/03776382413189b96ab415b4994ed6a2 to your computer and use it in GitHub Desktop.
Week 2, Day 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Week 2, Day 1.txt | |
Main subject: APIs and the web | |
How does the web work?--Starts with a web request (where you type in the URL). Sends message from our computer through a series of tubes to the server. | |
http = hypertext transfer protocol | |
Responds primarily with html, css, and javascript (only responses from a web request) | |
When we type a URL into our browser, that is a GET request (we just don't see it). | |
GET http:// en.wikipedia.org/ wiki/stuff | |
verb protocol domain URL | |
Common verbs: The browser doesn't understand these verbs, but our server does (where we may use them) | |
GET - reading | |
POST - changing | |
PATCH - for updating | |
DELETE - for removing | |
HTTP Response | |
status HTTP/1.1 200 OK | |
headers Date: <--date and time the web response is sent | |
Server: <--Type of server and its Operating System | |
Last-Modified: | |
Etag: | |
Content-Type: <--type of content and character set used (English/UTF-8(?)) | |
Content-Length: 131 <-(131 characters) | |
body <html> | |
<head> | |
<title>An Example Page</title> | |
< | |
json is a combination of strings, arrays, and hashes. | |
Status Codes: (always 3 digits long, first digit is important for error type) | |
100 - informational (fairly uncommon) | |
200 - Success (usually 200 OK) | |
300 - Redirect (301 - moved permanently; 302 - found) | |
400 - Client Error (your fault; 404 Page Not Found--going to a URL that doesn't exist; 403 Forbidden--You don't have authorization to do this particular web request; Twitter for a long time had 420 Enhance Your Calm--in response to sending 50,000+ web requests per second--servers can create their own) | |
500 - Server Error (my fault; 500 Internal Server Errror is most common; 503 Gateway Timeout (?)) | |
bitly (?) takes a longer URL path and exchanges it for a shorter URL (useful for twitter with a 140 character limit) | |
APIs deliver data back in response to server request (as opposed to user friendly information like css, javascript, and html) | |
A gem is a library of ruby code. | |
subl . <- terminal command to open the current directory in Sublime | |
In URLs, spaces are encoded to be replaced with %20 | |
URI is almost interchangable with URL. It is a package in Ruby that will encode for URLs. It is included when we use the gem "require 'http'" | |
wordnik.com is useful for creating URLs to use for API |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment