0

I am a beginner with the RESTful architecture and I have some questions about it. I have understood the main ideas : Verbs & Ressources. But I don't really know what URIs I should use for my Web-application project.

-> What URI should I use to get pages such as the subscription / register page (to create a new user), or any other pages that enables to create new ressources.

Should I do something like : GET webiste.com/user/new or : GET website.com/subscription

Thank you.

user2308044
  • 63
  • 1
  • 3

1 Answers1

1

For creating new objects, it should be using POST, like:

POST website.com/users
POST website.com/subscriptions

GET should be used for retrieving / reading, like:

GET website.com/users?name=adam
GET website.com/users/35 (get user with id of 35)
GET website.com/users (get all users)
  • Well, ok but according to wikipedia POST http://example.com/resources/ creates a new entry in the collection where the ID is assigned automatically by the collection. The ID created is usually included as part of the data returned by this operation. – user2308044 May 26 '13 at 15:51
  • That is right, when you create a new user, you don't know the user ID yet. When the server creates the new user, it should return the new user data with the user ID in the "response". – GiantEnemyCrab May 26 '13 at 16:01