1

Is there a way to define a route that can only receive POST data? In Laravel you can do this:

Route::post('admin/content/{id}', 'ContentController@update');

Is there a way to do this with a Craft route?

Tried this to no avail:

'POST, newseventsapi/v1/login' => array('action' => 'api/Login')
1
  • Taking out the comma after POST seems to work
    – Jim Wyse
    Apr 25 '19 at 18:33
0

Taking out the comma after POST seems to work

Correct. A common is only needed if you want to allow multiple HTTP methods like POST,PUT.

Here's the Yii documentation on the topic: https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#http-methods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.