J'ai choisi 410 Gone lorsque j'ai essayé de valider un code de vérification expiré dans l'API Web C#. J'utilise LE tutoriel REST API pour référence https://www.restapitutorial.com/httpstatuscodes.html
/// <summary>
/// Verify email address
/// </summary>
/// <param name="verificationCode">Verification Code for ownership of an email address</param>
/// <returns>Verify Email Update Api Response</returns>
[HttpPut]
[Route("{verificationCode}/verify-email-update")]
[ResponseType(typeof(VerifyEmailChangeApiResponse))]
public async Task<IHttpActionResult> VerifyEmailUpdate(Guid verificationCode)
{
var response = await this.emailVerificationService
.VerifyEmailUpdate(verificationCode)
.ConfigureAwait(false);
switch (response.Result)
{
case VerifyEmailUpdateApiResultType.Ok:
return this.Ok(response);
case VerifyEmailUpdateApiResultType.EmailAddressAlreadyVerified:
return this.Content(HttpStatusCode.Conflict, response);
case VerifyEmailUpdateApiResultType.Expired:
return this.Content(HttpStatusCode.Gone, response);
case VerifyEmailUpdateApiResultType.UnknownProblem:
return this.Content(HttpStatusCode.BadRequest, response);
}
return this.Ok(response);
}