title: Passing ID to Controller within a Post Request
body: <p>I have a function in my VueJs frontend, which passes through an ID to my Controller, in this Controller I want to call a backend function, which takes the ID as an argument.</p>
  <p>However, I can't seem to actually receive and store this ID in my Params, does anyone have tips for how I should correctly structure this? I've read the guides, but I can't see exactly how that fits within my small use case. ie my controller is not set up correctly to receive the payload of my Post Request.</p>
  <p>Any tips appreciated.</p>
  <p>Frontend:</p>
  <pre><code>  forwardTicketId(ticketId) {
    const requestOptions = {
      method: &quot;POST&quot;,
      headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
      body: JSON.stringify({ ticket_id: ticketId }),
    };
    fetch(
      &quot;http://localhost:3000/home/current_ticket_id&quot;,
      requestOptions
    )
      .then((response) =&gt; response.json())
      .then((data) =&gt; console.log(data));
  },
  </code></pre>
  <p>Outgoing request payload:</p>
  <pre><code>{
  &quot;ticket_id&quot;: 85669229421
  }
  </code></pre>
  <p>Controller:</p>
  <pre><code>module Panel
    class TicketIdController &lt; HomeController
      def create  # needs id param to be passed in 
        result = Home::UtilityClasses::ActionClass.new(params[:id].to_i).call
        render json: { reply: result }
      end
    end
  end
  </code></pre>
  <p>Routing:</p>
  <pre><code> def draw_ticket_id
     controller: 'ticket_id' do
      get 'current_ticket_id/:id', action: 'create'
    end
  end
  </code></pre>