0

I'm trying to find the best way to make a restful URL when I need to use some complex parameters.

In my original design I needed to create a setting and I used this URL to go to the form to create the new setting:

GET /setting/new

Right now I've introduced settingcategories (1 settingcategory contains multiple settings) and I'm searching for the best way to go to the settingsform using the REST principle.

Some possible solutions:

//using a parameter
    GET /setting/new?settingcategory=5152ebabf1f7b6134b000007
//include the settingcategory in the URL
    GET /settingcategory/5152ebabf1f7b6134b000007/setting/new
//using bad Restful design and use a POST to display the form
//and put the settingcategory in the body of the POST
    POST /setting/new

I'm pretty new to REST but at the moment the second option seems the most logical to me.

MMeersseman
  • 2,541
  • 1
  • 13
  • 8
  • I liked this tutorial on designing REST API's: https://blog.apigee.com/detail/restful_api_design – Sami N Mar 28 '13 at 10:25

1 Answers1

0

I would avoid using the parameter in query string like "?settincategory=..."

You can do like in your second option, it would be cleaner to have :

/settingcategories/5152ebabf1f7b6134b000007/setting/new

hemma731
  • 148
  • 1
  • 1
  • 8