REST Flashcards
What is REST
REST, or Representational State Transfer, structural design approach for crafting loosely attached applications using HTTP, style of web communications that creates a variety of outputs to represent a resource, such as JSON
Describe some common REST verbs and what their purpose is
Get (get one/get all), Post (new), Put(update), Delete(ya know)
What does the HEAD verb do?
returns all of the HTTP headers like get but the server cant return a message-body in the response
What does the OPTIONS verb do?
allow clients to obtain parameters and requirements for specific resources and server capabilities without taking action on the resource or requesting the resource.
What type of REST request is typically made when a browser navigates to a web page?
browser sends an HTTP GET request specifying the URL of its HTML page. The server retrieves the requested document from its file system and returns an HTTP response containing the document and an HTTP Response status code of “200 OK” (indicating success).
What are request headers?
a list of strings sent the client program to server on every HTTP request, usually invisible, contain information about the request, such as the format of data sent or expected, whether to cache information, and authentication information.
If you wanted to see what network traffic is going from your JavaScript app to other servers from Chrome, how would you view that?
What is a Status Code? Can you name some?
server always returns a message for every request
1XX - informational, 2XX - fine/completed, 3XX - redirect, 4XX - client error, 5XX - server error
200 OK, 401 Unauthorized(not authenticated), 403 Forbidden(like not admin), 404 not found, 500 internal server error
What’s the difference between SOAP and REST?
Simple Object Access Protocol.- protocol, can’t use REST, defines its own security.
REpresentational State Transfer - can use SOAP web services because it is a concept, inherits security measures from the underlying transport
What is an authorization header? How do you get one? How do you use it?
What is a JWT?
JSON Web Tokens-standard that defines a compact and self-contained way to securely transmit information between a client and a server as a JSON object
You are building a resume and job opportunity REST API:
What endpoint and verb would you use to list all resumes?
What endpoint and verb would you use to get a specific resume?
What endpoint and verb would you use to update a specific resume?
What endpoint and verb would you use to delete a specific resume?
What endpoint and verb would you use to get a specific job opportunity?
What endpoint and verb would you use to add a candidate for a specific job opportunity?
What is CORS and what steps do you need to take to make sure it’s not an issue?
Cross-Origin Resource Sharing, and is a mechanism that allows resources on a web page to be requested from another domain outside their own domain. It defines a way of how a browser and server can interact to determine whether it is safe to allow the cross-origin request.