ibaralf
ibaralf

Reputation: 12528

REST response code for existing data

Just wondering what HTTP status code I should return for a REST api if the posted data already exists. Example if I have a create account API that requires an email.

1) If this email already exists on my DB, what status code should I return?

2) If I redirect to another page, like an existing account login page, should the status code then be 200? or 300 for redirection?

If this question has been answered, please just give me the link and I can delete this, but so far I only saw questions for invalid data.

Upvotes: 5

Views: 5206

Answers (1)

ebo
ebo

Reputation: 2747

This post suggests to use the 409 Conflict status code when duplicated data is submitted.

Upvotes: 8

Related Questions