Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Why 202 and not 201?

At 1:35 of the Responses video for the REST API Basics course the instructor says you can use a 202 to let the requestor know something has been created. Why 202 and not 201?

1 Answer

Hi Robert,

Depending on the needs using Created could be misleading. Example: What if I am sending over data that needs to be accepted first? This would give the user the idea that it already was accepted and is good to go.

However, using 202 Accepted would give the user the idea that the data went and was taken as is.

So really, it would all depend on how it is being used on what would be a better one to use.