Answers.Body: <p><strong>EDIT:</strong>
  In the first version of the answer I forgot the <code>/admin</code> part of all the example URLs. Added now.</p>
  
  <p><strong>TL;DR version:</strong></p>
  
  <p>To get to the point first before explaining more in-depth: You need to convert the names from camelCase (with capitalisation in the name) to kebab-case (with dashes instead). I would suggest renaming your controller to simply <code>DataCaptureController</code>, since it's within the Gated Content plugin anyways, and you should be able to use:</p>
  
  <pre><code>https://craftcms.localhost/admin/gated-content/data-capture/index
  </code></pre>
  
  <p><strong>Full answer:</strong></p>
  
  <p>So, the structure is basically <code>plugin-name/controller-name/method-name</code>, all in kebab case, meaning that what is <code>someName</code> should be <code>some-name</code>, as not all servers are case sensitive (althouth URLs technically are, if I'm correct). Also, the <code>Controller</code> and <code>action</code> parts of the class/method name is implied, as you've already correctly done, but as far as I know, not adding the plugin name to the front of your controller (I have not checked this specifically).</p>
  
  <p>So in your case it should be something like this:</p>
  
  <pre><code>https://craftcms.localhost/admin/index.php?p=actions/gated-content/gated-content_data-capture/index
  </code></pre>
  
  <p>I am honestly not quite sure how underscores are treated in kebab-case, so it could be that this is the correct form:</p>
  
  <pre><code>https://craftcms.localhost/admin/index.php?p=actions/gated-content/gated-content-data-capture/index
  </code></pre>
  
  <p>Also, you should be able to use the url like this:</p>
  
  <pre><code>https://craftcms.localhost/admin/gated-content/gated-content-data-capture/index
  </code></pre>
  
  <p>(Or, if you really prefer for some reason, with <code>/actions</code> in the URL:)</p>
  
  <pre><code>https://craftcms.localhost/admin/actions/gated-content/gated-content-data-capture/index
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-28T12:47:38.757Z
Answers.LastActivityDate: 2019-10-29T08:46:12.243Z
Answers.LastEditDate: 2019-10-29T08:46:12.243Z
Answers.UserDisplayName: KSP
Body: <p>struggling to decipher how to link a plugins controller to an action route. The docs say to use "<a href="https://pluginfactory.io/" rel="nofollow noreferrer">https://pluginfactory.io/</a>" to scaffold one, but what it generates is a different structure to what the documentation say to use.</p>
  
  <p>I've got a plugin called <code>Gated Content</code> sitting inside: <code>plugins/gated-content</code></p>
  
  <p>I've got a controller named and located at:</p>
  
  <pre><code>plugins/gated-content/src/controllers/GatedContent_DataCaptureController.php
  </code></pre>
  
  <p>with the class name of of <code>GatedContent_DataCaptureController</code></p>
  
  <p>I've just got an <code>actionIndex</code> method which var dumps and exits.</p>
  
  <p>Which would suggest (according to the docs) that the URL to access this should be:</p>
  
  <pre><code>https://craftcms.localhost/index.php?p=actions/gatedContent/dataCapture/index
  </code></pre>
  
  <p>But it just throws a 404.</p>
  
  <p>Inside of the <code>.craftplugin</code> file I've also added <code>"controllerName":"GatedContent_DataCaptureController</code> incase, but doesn't seem to make a difference.</p>
  
  <p>What is the correct pattern to use for each of these?</p>
  
  <p>Thanks</p>
  
Tags: <plugin-development><craft3><controller>
Title: Finding the correct actions url
ThreadText: # Finding the correct actions url
  
  (Asked by: username_0 on 2019-10-27)
  
  struggling to decipher how to link a plugins controller to an action route. The docs say to use "<https://pluginfactory.io/>" to scaffold one, but what it generates is a different structure to what the documentation say to use.
  
  I've got a plugin called `Gated Content` sitting inside: `plugins/gated-content`
  
  I've got a controller named and located at:
  
  ```
  plugins/gated-content/src/controllers/GatedContent_DataCaptureController.php
  
  ```
  
  with the class name of of `GatedContent_DataCaptureController`
  
  I've just got an `actionIndex` method which var dumps and exits.
  
  Which would suggest (according to the docs) that the URL to access this should be:
  
  ```
  https://craftcms.localhost/index.php?p=actions/gatedContent/dataCapture/index
  
  ```
  
  But it just throws a 404.
  
  Inside of the `.craftplugin` file I've also added `"controllerName":"GatedContent_DataCaptureController` incase, but doesn't seem to make a difference.
  
  What is the correct pattern to use for each of these?
  
  Thanks
  
  **Tags:** plugin-development, craft3, controller
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-28. Score: 2
  
  **EDIT:**
  In the first version of the answer I forgot the `/admin` part of all the example URLs. Added now.
  
  **TL;DR version:**
  
  To get to the point first before explaining more in-depth: You need to convert the names from camelCase (with capitalisation in the name) to kebab-case (with dashes instead). I would suggest renaming your controller to simply `DataCaptureController`, since it's within the Gated Content plugin anyways, and you should be able to use:
  
  ```
  https://craftcms.localhost/admin/gated-content/data-capture/index
  
  ```
  
  **Full answer:**
  
  So, the structure is basically `plugin-name/controller-name/method-name`, all in kebab case, meaning that what is `someName` should be `some-name`, as not all servers are case sensitive (althouth URLs technically are, if I'm correct). Also, the `Controller` and `action` parts of the class/method name is implied, as you've already correctly done, but as far as I know, not adding the plugin name to the front of your controller (I have not checked this specifically).
  
  So in your case it should be something like this:
  
  ```
  https://craftcms.localhost/admin/index.php?p=actions/gated-content/gated-content_data-capture/index
  
  ```
  
  I am honestly not quite sure how underscores are treated in kebab-case, so it could be that this is the correct form:
  
  ```
  https://craftcms.localhost/admin/index.php?p=actions/gated-content/gated-content-data-capture/index
  
  ```
  
  Also, you should be able to use the url like this:
  
  ```
  https://craftcms.localhost/admin/gated-content/gated-content-data-capture/index
  
  ```
  
  (Or, if you really prefer for some reason, with `/actions` in the URL:)
  
  ```
  https://craftcms.localhost/admin/actions/gated-content/gated-content-data-capture/index
  
  ```
  
  
  ---
  
  