Reputation: 31
One of the external .NET desktop application is supposed to update our internal MySQL database (Couple of inserts and updates). We’ve agreed to expose a REST web service in order to facilitate this.
I’m thinking of accepting the inputs as a String in JSON format and process inside my REST service. Since there’s lot of values are supposed to be passed into this web service, I’m expecting the inputs in a JSON format without having them in query string or as in params. Is this the best/acceptable way of handling these kind of cases or any other any way of designing this?
Upvotes: 0
Views: 320
Reputation: 854
If you want insert or update a resource through rest then following is the best practices to design it.
Insert
Request: POST /resources
Body {data in json format}
Response : 201 Created
Update
Request : PUT /resources/{id}
Body {data in json format}
Response : 200 OK
Here you can replace "resources" with the term that you want to manage through rest service. And {id} in second case is the identifier which can identify the resource you want to update in your repository.
Upvotes: 1