I am just starting to learn how to design/write RESTful APIs. I have a general question:
Assume I have some sort of simple SQL database and I'm writing an API that allows to create a new record, view records, delete a record or update a record.
Assuming I want to delete a record, is it usually better to pass in the ID of the record in the URL, for example, /api/delete_record?id=10, or is it better to do something like:
/api/record and have it accept GET, POST, PATCH and DELETE, and the data is handled through the JSON body in the request.
I've written a small API using Flask in Python and what I have is just one URL: /record which accepts all the above HTTP methods. It looks at the method in the request and expects the request body in JSON accordingly. Is that considered good or bad practice?
Any suggestions would be greatly appreciated. Please note that I am still very new to all of this. I've worked with APIs before but I've never developed any. Thanks!