What is a Data Transfer Object(DTO)? Why is it used?

A DTO (Data Transfer Object) is used to transfer only the required data between layers or APIs instead of exposing the full Entity…