Loading

Quipoin Menu

Learn • Practice • Grow

flask / What are REST APIs?
tutorial

What are REST APIs?

An API (Application Programming Interface) allows different software applications to communicate. REST (Representational State Transfer) is a popular architectural style for web APIs. Flask makes building REST APIs simple.

REST API uses HTTP methods (GET, POST, PUT, DELETE) and returns data in JSON format.

Why REST APIs?

  • Enable frontend (React, Vue) or mobile apps to communicate with backend.
  • Decouple client and server.
  • Stateless – each request contains all needed information.
  • Use standard HTTP methods and status codes.

REST API Example in Flask

from flask import Flask, jsonify, request

app = Flask(__name__)

@app.route('/api/users', methods=['GET'])
def get_users():
users = [{'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}]
return jsonify(users)

Testing with curl

curl http://localhost:5000/api/users


Two Minute Drill
  • REST APIs use HTTP methods and return JSON.
  • Use `jsonify()` to return JSON responses.
  • Flask makes building APIs straightforward.
  • Test APIs with curl, Postman, or browser.

Need more clarification?

Drop us an email at career@quipoinfotech.com