Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:32:00+00:00 2026-06-04T20:32:00+00:00

I am trying to make a POST request to /api/kpi?data=some+stuff : curl -i http://127.0.0.1:9010/api/create_kpi

  • 0

I am trying to make a POST request to /api/kpi?data=some+stuff:

curl -i http://127.0.0.1:9010/api/create_kpi -F data="some stuff" 

but I’m getting a 404.

My routes are:

# config/routes.rb

namespace :api do
  resource :kpi,  :except => [:edit, :destroy]
end

Which should hit my controller

# app/controllers/api/kpi_controller.rb

class Api::KpiController < ApplicationController
  def create
    temp = Kpi.new(params[:data])
  end
end

So I am guessing the paths are not correct. Right? I am having a hard time understanding whether my route is incorrect, or the controller, or the call.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:32:01+00:00Added an answer on June 4, 2026 at 8:32 pm

    When you get a 404, check your routes. It usually means there is no route to the controller to reach. Routes are what makes the link between URLs and controllers. If your controller was getting hit, it’d either work or give you a runtime error.

    1. Inspect your routes by running rake routes. It’s a very helpful tool. It should give you something like this:

          users GET    /users(.:format)          users#index
                POST   /users(.:format)          users#create
       new_user GET    /users/new(.:format)      users#new
      edit_user GET    /users/:id/edit(.:format) users#edit
      

      You can see that it gives you the mapping of what [method, URL] request will hit which [controller, action]. For example, here, POST /users will trigger action create of UsersController.

    2. Given a controller/resource name, Rails will, by convention, go looking for the plural of that name. For example, given resources :user, Rails will go looking for UsersController in file app/controllers/users_controller.rb. (Path/file names have to match the name!)

      @yfedblum talks about the use of singular and plural in Rails into more detail.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a POST http.request in Node to an API where
I'm trying to use the POST method in jQuery to make a data request.
I am trying to make a POST request. Here my code: var myModel =
Using jquery1.7.1 and django1.3 ,I was trying to make a post request through ajax,in
I am trying to make a curl POST from java through java's Runtime. When
I'm trying to make a simple HTTP post a endpoint with ONLY url arguments.
i am trying to make the post using my linkedin api application, The issue
I'm trying to make a post request via ajax using jQuery (for the BaseCamp
I'm trying to use Zend_Http_Client to make a simple post request on a site
I have been trying to make wall post from multiple pages but when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.