# Restful create URL

**URL:** <https://www.ruby-forum.com/t/restful-create-url/185581>\
**Category:** Rails\
**Created:** [March 23, 2010, 3:30am UTC](https://www.ruby-forum.com/t/restful-create-url/185581 "2010-03-23T03:30:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgallo1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sgallo1](https://www.ruby-forum.com/u/sgallo1)\
**Post date:** [March 23, 2010, 3:30am UTC](https://www.ruby-forum.com/t/restful-create-url/185581/1 "2010-03-23T03:30:17Z")

</div>

I’m creating and api.  
I create a scaffold

script/generate scaffold user

I have users controller, but how do I call the create method via a URL

ie…localhost:3000/users/create.xml?params

new doesn’t work as it returns the empty user object in XML as it  
should,  
but when I call create  
localhost:3000/users/create.xml?params  
I get the below error

“Couldn’t find User with ID=create”

I get that is has to do with the routing, but I don’t want to call  
create with and ID as I don’t know what it is going to be.

Any help is apperciated.

Cheers,  
SG

---

<div class="post-metadata">

**Author:** ![sgallo1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@sgallo1](https://www.ruby-forum.com/u/sgallo1)\
**Post date:** [March 23, 2010, 7:57am UTC](https://www.ruby-forum.com/t/restful-create-url/185581/2 "2010-03-23T07:57:43Z")

</div>

## As you now URL its a GET method, but according RESTful rules create it’s a POST method. Rails defines seven controller methods for RESTful resources by convention. They are: Action HTTP Method Purpose

index GET Displays a collection of resources  
show GET Displays a single resource  
new GET Displays a form for creating a new resource  
create POST Creates a new resource (new submits to this)  
edit GET Displays a form for editing an existing resource  
update PUT Updates an existing resource (edit submits to  
this)  
destroy DELETE Destroys a single resource

You can find out it your self by:  
$ rake routes

If you still want use create action by GET method you can reach it by  
routes.rb file. Following links help you figure out it:  
[http://api.rubyonrails.org/classes/ActionController/Routing.html](http://api.rubyonrails.org/classes/ActionController/Routing.html)  
[http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html](http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html)
