GET Product by Refid Returning 'Null' when not Found
ID: 826702
No Fix
Published on 5/16/2023
•
Last update on 7/1/2024
Summary
The get product by refid route (/catalog_system/pvt/products/productgetbyrefid) is returning a null instead of a simply 404 response when not finding a valid id on a given store's catalog
Simulation
- Run the following cURL
curl --location --request GET 'https://mystore.vtexcommercestable.com.br/api/catalog_system/pvt/products/productgetbyrefid/667'
--header 'Content-Type: application/json'
--header 'Cookie: janus_sid=beb23e63-ccb5-4619-9ee7-f1f61deb0683'
You should get the following response if the given id doesn't exist

This is incorrect since the expected is a 404 - Not Found
Workaround
Using other APIs for GET product such as Get Product by ID if this 404 response is imperative for anything you're working with.