Bunch of questions about Python APIs

  1. What’s the difference between json.dumps() and flask.jsonify()?
  2. What’s the easiest way to make APIs in Python (surely there’s an easier way instead of using Flask?)
  3. What’s the point of PUT if you could DELETE a source and POST it again (with new content)?
  4. How come Flask is used for making HTML pages and APIs?

Hi SnakeyKing!
Hope you’re doing fantastic!

json.dumps() is a method provided by the json module of Python that converts a Python object to a JSON string, whereas flask.jsonify() is a method provided by the Flask framework that returns a JSON response with the specific JSON headers.
Another easy way to make APIs in Python is by using FastAPI.
The main difference between PUT and DELETE is that PUT updates an existing resource, while DELETE removes it. If you delete a resource, you cannot simply create it again because it would have a different ID.
Flask is a micro web framework for creating web applications and APIs quickly and easily. It is capable of handling both tasks interchangeably. You can use Jinja2 to render HTML templates and use Flask’s jsonify to serialize API responses.

I hope this helps.


Sorry for the block. New to the Replit support. Very used to stackoverflow.

I was thinking about that too…

Anyway, thanks for the awnsers!
Also I just found out U joined 7 minutes ago so Welcome to Replit Ask!

1 Like

No worries! Good luck with the project!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.