How would one create a REST web service to write a row into a databse table. Use the follwoing scenario:
The table is called Customer - the data to be inserted into the row would be the name, addresss, telephone number, email.
I think its impossible to describe the whole thing end to end in Java or C#, and I would never expect that, but here are the questions I have popping into my head as I prepare for coding:
- How the URI would look (eg. if you use this URL - http://www.example.com/)?
- What info would go into the HTTP envelope?
- Would I use POST when writing to the database in this way?
- Do I use a resource to store the posted data from the client? Is this even necessary if the data is being written to a database anyway?
- When the data to be writeen into the db is recieved by the server - how do I physically insert it into the database - do I call some method on the server to actually write the data (in Java)? - this doesn't seem to fit with truely REST architecture - shunning RPC calls.
- Should I even be bothering writing to a DB - should I be storing my data as a resource?
As you can see I need a few issues clearing in my head. Any help much appreciated.