Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
olback1124233dA JSON api should use, well... JSON. So yes, your form should post to a json endpoint.
Edit: requires you to use fetch/XMLHttpRequest or whatever it's called.
HCC5GDKc742333dYour API being a JSON API and a RESTful API are two separate matters to decide on
C0D44764733dIf you don't need to hide your api endpoint, use frontend post.
If you need to hide your api endpoint: backend post.
That's really all it comes down to.
What you send the api could be anything from json, xml, binary, some encrypted blob, or something else, it's really up to the api in question to dictate what it can and can't accept.
Json is just a textual representation of the data, the api being "restful" is its own problem.
BobbyTables240633d@HCC5GDKc7 I think I've been indoctrinated by REST that anytime I work with a JSON API I automatically assume REST. So I completely agree with you.
@IntrusionCM (This is greatly simplified but roughly...) Web page to enter in requests, edit requests, claim requests, mark requests complete. All this is tracked in DB. Also need this to have an API for automation of managing said requests.
I find it easier to explain it without the usual shenanigans (buzzword bingo).
Requests seem pretty simple, as the need for stuff beyond CRUD should be minimal (complex search, stats, aggregating, ...)
As such, an REST API for CRUD should be a good start.
That's the public API - handling CRUD.
Internal stuff depends on the cost / usage, eg regarding database:
You can create a database agnostic software (high cost) or just depend on MySQL (lower cost).
FLASK as an ORM has some abstraction, but being (truely) database agnostic would require more Work (eg adapter for the different database systems, additional layer for abstraction between database adapter - business logic).
Thus... Draw an onion.
Outer skin is the public API, possible consumer is a user or an automation / testing system.
Inner layers: What libraries do you use for which task? How do they interact? Is there a need for seperation / abstraction?
Core: The services you use - eg. a database, maybe an public API as Google Maps, maybe Pornhub ;)
Drawing the onion might sound stupid, but it's easier than drawing a complex UML / whatever diagram...
don-rager84733dI just want to emphasize that using a JSON Api doesn't equate to having a REST Api or that you have to make it restful since I came across this misconception a lot with former colleagues and class mates