Answers.Body: <blockquote>
    <p>Taking out the comma after POST seems to work</p>
  </blockquote>
  
  <p>Correct.  A common is only needed if you want to allow multiple HTTP methods like <code>POST,PUT</code>.</p>
  
  <p>Here's the Yii documentation on the topic: <a href="https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#http-methods" rel="nofollow noreferrer">https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#http-methods</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-25T22:54:36.543Z
Answers.LastActivityDate: 2019-04-25T22:54:36.543Z
Answers.UserDisplayName: Brad Bell
Body: <p>Is there a way to define a route that can only receive POST data?
  In Laravel you can do this:</p>
  
  <pre><code>Route::post('admin/content/{id}', 'ContentController@update');
  </code></pre>
  
  <p>Is there a way to do this with a Craft route?</p>
  
  <p>Tried this to no avail:</p>
  
  <pre><code>'POST, newseventsapi/v1/login' =&gt; array('action' =&gt; 'api/Login')
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-25T18:33:17.497Z
Comments.Text: Taking out the comma after POST seems to work
Comments.UserDisplayName: Jim Wyse
Tags: <plugin-development>
Title: Define POST or GET for a route
ThreadText: # Define POST or GET for a route
  
  (Asked by: username_0 on 2019-04-25)
  
  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')
  
  ```
  
  **Tags:** plugin-development
  
  > **Comments:**
  > **username_0**: Taking out the comma after POST seems to work  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-25. Score: 0 | Accepted answer
  
  > 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>
  
  
  ---
  
  