I made this namespace and route:
namespace :api do
resource :create_kpi, :except => [:edit, :destroy]
end
the controller looks like this:
class Api::CreateKpiController < ApplicationController
def create
temp = Kpi.new(params[:data])
puts "temp: "
puts temp.inspect
end
end
and I would like to do something like this:
POST http://127.0.0.1:my_port/api/create_kpi?data="some stuff"
but I am not sure how to construct the url with the setup I have. How should my url look like?
Thanks!
You should not be passing data in query parametr for the POST request, so your url should look like HOST:PORT/api/create_kpi and POST DATA should have data=”some stuff”
here is a curl example