request object is available in any route function. Import it from flask:
JSON body
ForPOST, PUT, and PATCH requests with a JSON body:
request.get_json() parses the body and returns a dict. If the body is missing or not valid JSON it returns None. Validate the data in the service layer, not the route.
Query parameters
request.args is an ImmutableMultiDict. Use .get(key, default, type=) to safely read values with type coercion.
Headers
token_required decorator — routes generally don’t need to read headers directly.
URL path parameters
Flask supports dynamic URL segments using<variable>:
string (default), int, float, path, uuid.