200 OK vs 202 Accepted – Whats the difference?

When working with Azure cloud services like Azure Logic Apps or Azure Automation (Runbooks), you often come across that service endpoints return 202 Accepted instead of 200 OK on success. But why do they do that, and what is the difference between the two?

202 Accepted

202 Accepted

200 OK means that the request has succeeded and the processing of our request is done. The response is the final payload and the service will not take further actions.

202 Accepted on the other hand means that the request have been accepted for processing, and the service will now start. This does not mean that the processing itself is a success, nor that the process have ended.

The 202 accepted is therefor the equivalent of a fire-and-forget, and all you know is that the fire was a success. With 200 OK you should expect the processing not only to be done but also be successful.

MORE TO READ:

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in General .NET. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.