Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
dotnet api request / response classes

I am currently looking for an elegant way to decide between request and response objects. Let's say I create an animal and my API generates the ID for the animal. I don't want someone to provide the ID in the body of the request. I also don't want the ID to be displayed as a request example, e.g. in a Swagger UI.

If I return the created animal afterwards, then the ID should be given and also Swagger UI should show the ID for Responses as an example.

My only idea for this is to create two classes for the animal:

  • PetRequest & Pet (Response) and to cast the PetRequest to Pet.

Is there a better way to do this?

enter image description here

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!