Menu
Feedback
Start here


Known issues
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

  1. 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

{"base64":"  ","img":{"width":1136,"height":262,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":32230,"url":"https://raw.githubusercontent.com/vtexdocs/help-center-content/refs/heads/main/docs/en/known-issues/Catalog/get-product-by-refid-returning-null-when-not-found_1.png"}}

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.

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page
Still got questions?
Ask the community
Find solutions and share ideas in the VTEX community.
Join our community
Request support from VTEX
For personalized assistance, contact our experts.
Open a support ticket
GithubDeveloper portalCommunityFeedback