Award API response code for awards that were already used

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Summary

When posting an award to the URL projects/:project/merge_requests/:merge_request_iid/notes/:note_id/award_emoji with the data:

{
   name: 'any_valid_award'
}

the request responds with 404 if that award was already used. It is understandable why 404 was chosen for this scenario, as this resource is really not available in the pool of possible awards. However, this code is most of the time interpreted as if that award does not really exist (invalid award). To resolve this conflict in the client side, string treatment is required to understand what is the real underlying problem.

After reading HTTP status codes from w3.org, I found a code that could be used for this case 409 - Conflict

The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.

Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type.

Changing this status code would be most beneficial for the client using the API, as he/she would be able to redirect the problem according with the code 404 or 409 without the need to read the string to be able to take the appropriate action.

Steps to reproduce

Call the this API twice. The first time it will return a valid status code, the second will be 404

projects/:project/merge_requests/:merge_request_iid/notes/:note_id/award_emoji with the data:

{
   name: 'any_valid_award'
}

What is the current bug behavior?

This is not really a bug, it would be something of an improvement, but I found no appropriate type among Bug, Feature proposal and Research proposal

What is the expected correct behavior?

The API respond an error code other than 404

Possible fixes

Change the status code to something other than 404

Edited Sep 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading