views:

46

answers:

2

I'm developing API for booking(hotels, cars, apartments, etc.) system.

Response will be in XML but how to handle requests in the best way ?

Should they be an XML requests like on Travelfusion or RESTful like on Cleartrip ?

Service is written in Grails.

+2  A: 

I'd take elements from each of the two approaches you referenced. GET's and DELETE's can use a simple query string approach for identifying the data to read or delete. You may only need to have a param called "id" in many cases.

PUT's and POSTS's can use an XML payload to better represent the underlying data structure and prevent long, confusing query strings.

Both approaches are made particularly easy given Grails data binding and Groovy XMLSlurper. In the end you can probably go either way and be fine.

Grails in Action (Chapter 11) has a pretty good section on REST and other remote access technologies- you might want to give it a look.

ecodan
+1  A: 

You can write a Restful Web Service and use XML, XML is just a data type or format. You should use the style that is the easiest for you and makes the most sense for your application. REST has become really popular lately because of its simplicity, and if you are going to expose your Web Service to other potential developers you should implement a RESTful api and support XML and JSON.

BrennaSoft