V
V
Vadim Stepanenko2020-12-31 21:41:06
PHP
Vadim Stepanenko, 2020-12-31 21:41:06

Is such an implementation a full-fledged API?

There is a site on one small mvc framework php. There are no ready-made cases for implementing the API, so I had to reinvent my wheel
. So, there is a controller. It processes all requests for site.ru/api/...
This controller has, for example, a getUserById section (site.ru/api/getUserById), which accepts incoming post or get request parameters. We process these parameters and render json.
Is such a rest api implementation?
I know, rest api has methods like post, put, delete, get. But I have these methods implemented through post / get parameters. Is it normal?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2020-12-31
@Vadim1899

API - application programming interface
So that is the full extent.
Don't worry about put and delete, it's common practice to pass the parameter method=put,delete
Sometimes the web server just doesn't support them.

A
Alexander Dokin, 2020-12-31
@alnidok

Well, you answered your own question. In a RESTful methodology, each entity must have a CRUD implementation. On the same URL, only the HTTP methods differ:
If you want exactly REST architecture, read something like this . Then it will become clear whether you need such an implementation or the current one is enough.
And besides the implementation of requests, there should be other layers: authorization (tokens / bearer / ip), caching, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question