<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>

CC BY-SA 4.0
2019-04-25T22:54:36.543Z
2019-04-25T22:54:36.543Z
Brad Bell
<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>

CC BY-SA 4.0
2019-04-25T18:33:17.497Z
Taking out the comma after POST seems to work
Jim Wyse
<plugin-development>
Define POST or GET for a route
# 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>


---

