Skip to main content
added 51 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the business, not the application. These codes should be handled and translated.

The key thing is that we send one or another when we want the HTTP client on the other side to behave in a very specific way. This is not obvious with 4xx status codes but thinks in 3xx status codes that can make HTTP clients follow redirections.

In line with the note above, 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client (or any other element within the network topology) might have cached the previous response and keep responding 404 Not found.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the business, not the application. These codes should be handled and translated.

The key thing is that we send one or another when we want the HTTP client on the other side to behave in a very specific way. This is not obvious with 4xx status codes but thinks in 3xx status codes that can make HTTP clients follow redirections.

In line with the note above, 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding 404 Not found.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the business, not the application. These codes should be handled and translated.

The key thing is that we send one or another when we want the HTTP client on the other side to behave in a very specific way. This is not obvious with 4xx status codes but thinks in 3xx status codes that can make HTTP clients follow redirections.

In line with the note above, 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client (or any other element within the network topology) might have cached the previous response and keep responding 404 Not found.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

added 229 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the business, not the application. So,These codes should be handled and translated.

The key thing is that we send one or another when we want the HTTP client on the other side to behave in a very specific way. It couldThis is not be obvious with 4xx status codes but thinkthinks in those 3xx status codes that can make HTTP clients follow redirections.

In line with the note above, worth saying that 404404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding with 404404 Not found.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the application. So, we send one or another when we want the HTTP client on the other side to behave in a very specific way. It could not be obvious with 4xx status codes but think in those 3xx that can make HTTP clients follow redirections.

In line with the note above, worth saying that 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding with 404.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400.

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the business, not the application. These codes should be handled and translated.

The key thing is that we send one or another when we want the HTTP client on the other side to behave in a very specific way. This is not obvious with 4xx status codes but thinks in 3xx status codes that can make HTTP clients follow redirections.

In line with the note above, 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding 404 Not found.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

added 229 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72

You could use 404 in both cases1 but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists and it's handling, handles and processing the requestprocesses requests, the problem is not at finding the resource, it's at processing the request. The server can handle itthe request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400 status code. 

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but something was wrong and it could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to our applicationsthe application. We do useSo, we send one or another to makewhen we want the HTTP client on the other side to behave in a very specific way. It could not be obvious with 4xx status codes but think in those 3xx that can make HTTP clients follow redirections.

In line with the note above, worth saying that 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding with 404.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases1 but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again"

Since the resource camera exists and it's handling and processing the request the problem is not at finding the resource, it's at processing the request. The server can handle it but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400 status code. Unlike 404, 400 means "ok, the resource does exist, the request has been handled but something was wrong and it could not be processed. Fix the issues and try again".

Remember that HTTP status codes are addressed to HTTP clients, not to our applications. We do use one or another to make the HTTP client on the other side behave in a very specific way. It could not be obvious with 4xx status codes but think in those 3xx that can make HTTP clients follow redirections.

In line with the note above, worth saying that 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding with 404.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

You could use 404 in both cases but semantically speaking it would be a little bit misleading because www.cameracompany.com/camera does exist. Usually, 404 means "resource not found, don't try again", but it could also mean "the resource might exist but I don't want you to know, stop trying"1.

One meaning or another, the most likely test any developer would do is checking whether the URL exists.

Since the resource camera exists, handles and processes requests, the problem is not at finding the resource, it's at processing the request. The server can handle the request but can't process it. It's somewhat a business or validation error that could perfectly be communicated through the 400. 

Unlike 404, 400 means "ok, the resource does exist, the request has been handled but could not be processed because something is missing, wrong-formated or the content doesn't make sense. Fix the issues and try again".

Remember that HTTP status codes are always addressed to HTTP clients, not to the application. So, we send one or another when we want the HTTP client on the other side to behave in a very specific way. It could not be obvious with 4xx status codes but think in those 3xx that can make HTTP clients follow redirections.

In line with the note above, worth saying that 404 is cacheable (by default). So, even if we change the wrong id with a good one, the HTTP client might have cached the previous response and keep responding with 404.


1: From the RFC - The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists

added 235 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72
Loading
added 33 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72
Loading
added 33 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72
Loading
added 33 characters in body
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72
Loading
Source Link
Laiv
  • 15k
  • 2
  • 34
  • 72
Loading