potpie icon indicating copy to clipboard operation
potpie copied to clipboard

Inconsistent Status Codes for Resource Creation (201 vs. 200)

Open DeepeshKalura opened this issue 10 months ago • 4 comments

I noticed that in several places within the backend, we are returning 200 OK for resource creation instead of 201 Created. According to MDN documentation, 201 is the appropriate status code when a new resource is successfully created.

Image

Steps to Reproduce:

Make a request to create a resource (e.g., POST /api/v1/conversations/).
Observe the response status code (should be 201 but sometimes returns 200).

Affected Endpoints:

POST `/api/v1/signup` 
POST `/api/v1/parse`
POST `/api/v1/conversations/`,  
POST `/api/v1/conversations/{conversation_id}/message/`,  

maybe more but this is the scope of my Issue.

Expected Behavior:

When a resource is created, the API should return 201 Created instead of 200 OK.
Consistent usage of status codes across the project.

Proposed Fix:

Update all affected endpoints to return 201 Created when a resource is successfully created.
Review API responses for consistency.

DeepeshKalura avatar Feb 11 '25 22:02 DeepeshKalura

Hi

RudolfPleml avatar Feb 11 '25 23:02 RudolfPleml

@RudolfPleml are you a bot?

if not are you new to github ??

DeepeshKalura avatar Feb 11 '25 23:02 DeepeshKalura

Yes i new

RudolfPleml avatar Feb 28 '25 00:02 RudolfPleml

@RudolfPleml yeah, man, enjoy your coding journey. My name is Deepesh. Nice to be your acquaintance, man.

DeepeshKalura avatar Feb 28 '25 05:02 DeepeshKalura