help
Root Question Message
return CreatedAtAction(nameof(GetById), new { Id = animal.Id }, _mapper.Map<AnimalDTO>(animal));
[HttpGet("{animalId}")]
public async Task<IActionResult> GetById(int animalId, CancellationToken cancellationToken = default)
{
var animal = await _animalRepository.FindByIdAsync(animalId, cancellationToken);
return animal != null ? Ok(_mapper.Map<AnimalDTO>(animal)) : NotFound("Unable to find the requested animal");
}
animalId
not Id
201 Created
response and sets the Location
header to the route from which you can fetch that resource