1

Whilst designing a framework to synchronize objects (entity models) between Magento2 and our CRM, I have found that Magento's REST API will return a StatusCode of 404 with the following JSON

{No such entity with %fieldName = %fieldValue}
{[parameters, {
  "fieldName": "customerId",
  "fieldValue": 30
}]}

-when trying to GET a customer, but this happens with any non-searchcriteria required GET call.

IMO, 404 should be a route not found, an honest 404. Entity not found should be a 204 (Content not found), or at the very least a 200 with the JSON that it returns.

Am I doing it wrong? Is it really supposed to return a 404 error, and I have to build my .net framework "improperly" to accomodate for this?

1 Answer 1

2

It seems Magento team decided to use 404 erro code for not found entities.

You can find code here: vendor/magento/framework/Exception/NoSuchEntityException.php:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.