I’m trying to build a REST API for managing simple queries to my database.
Following some tutorials, finally build step by step the example in the Guide, in Quick Start, and get my model working for GET and HEAD methods.
Created my API service inside a module, properly set, with minimal settings, request JSON parser on backend/main.php, registered the module in common/main.php and created the rule in urlManager there too (below the minimal usual rules, enablePrettyUrl, controller/action, …):
['class' => 'yii\rest\UrlRule', 'controller' => ['precapi']]
But whenever I tried some other methods, via CURL or Postman REST Client, it always gives me a 405 error:
[color="#008000"][font="Consolas,"]Method Not Allowed. This url can only handle the following request methods: GET, HEAD.[/font][/color]
I think I have tried so many different configurations and paths trying to solve it, but without any result.
Only thing is ‘enableStrictParsing’ => false’ in urlManager, because it gives me a 404 error on some URLs, and POST does not work with this too, although[size=“2”] the application is working as usual.[/size]
[size="2"]Any help will be appreciated.[/size]