Lecture 4 - Postman & API Flashcards

1
Q

GET Request

A
  • Requests data from a specified resource (typically used to retrieve data from a server).
  • Query strings are sent in the URL.
/test/demo_form.php?name1=value1&name2=value2
  • Can be cached, bookmarked, and remains in browser history.
  • Should not be used for sensitive data.
  • Restrictions on the datatype: only ASCII characters allowed.
  • Has length restrictions and is used only to request data, not modify it.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

POST Request

A
  • Sends data to a server to create or update a resource.
  • Data is stored in the request body.
  • Not cached, does not remain in browser history, and cannot be bookmarked.
  • No length restrictions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

GET vs POST

A
  • GET can be cached and bookmarked; POST cannot.
  • GET has length and data type restrictions; POST does not.
  • GET data is visible in the URL, making it less secure; POST data is not visible.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Other Requests

A
  1. PUT:
    • Sends data to create or update a resource.
    • Idempotent: multiple identical requests result in the same outcome.
  2. HEAD:
    • Similar to GET but without the response body.
    • Useful for checking what a GET request will return without downloading the content.
  3. DELETE:
    • Deletes the specified resource.
  4. PATCH:
    • Applies partial modifications to a resource.
  5. OPTIONS:
    • Describes communication options for the target resource.
  6. CONNECT:
    • Establishes a two-way communication tunnel with the requested resource.
  7. TRACE:
    • Performs a message loop-back test to test the path for the target resource, useful for debugging.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

REST API

A
  • A REST API (Representational State Transfer Application Programming Interface) is a web service that uses the principles and constraints of REST architecture to enable interaction between clients and servers. (A standard way of getting information that is running on a server.)
  • RESTful APIs are designed to be stateless, scalable, and easily accessible, allowing clients to perform CRUD (Create, Read, Update, Delete) operations on resources using standard HTTP methods.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Key Concepts of REST API

A
  1. Resources:
    • Resources are the objects or entities that the API interacts with, such as users, products, or orders. Each resource is identified by a unique URL.
  2. Stateless:
    • Each request from a client to the server must contain all the information needed to understand and process the request. The server does not store any client context between requests.
  3. Client-Server Architecture:
    • The client and server are separate entities that communicate over a network. The client makes requests, and the server processes them and returns responses.
  4. Uniform Interface:
    • A consistent and standardized way of interacting with resources. This typically includes using standard HTTP methods and status codes, and a predictable structure for URLs.
  5. Representations:
    • Resources can have multiple representations (e.g., JSON, XML). Clients and servers exchange these representations to perform operations on the resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Benefits of REST API

A
  • Scalability: Statelessness and separation of client and server enhance scalability.
  • Flexibility: Can handle multiple types of calls, return different data formats, and support multiple versions.
  • Simplicity: RESTful APIs use standard HTTP methods, making them easy to understand and implement.
  • Performance: The stateless nature can improve performance by reducing the server load.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly