rest - What is the difference between DTOs and API Resources -


i going through asp.net core tutorials , articles on how make restful api. me, seems in newer demos/articles, people refer dtos api resources. these 2 same concept different names or there difference between two? there standard/convention follow or opinion based?

in rest or web api, resource object methods operating. example, list of contact, specific contact id, update contact, delete contact - contact resource.

a dto (data transfer object) 1 way of implementing such resource. used when api modifying data in relational database. people have discovered pitfalls returning contact database entity directly client on web api. map contact entity contact dto.

so web api resource might dto doesn't have be. depend on situation. imagine have web api get/set time of day on device. wouldn't need create dto this, use string representing date. in case resource of api string.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -