We are using the 2020-10 REST API and have come across products which don't have a status field.
For an example please see X-Request-Id: 99bef7fd-09ed-4238-b4dc-7c44cf0d8f6f and screenshot below:
That's a bug right? It seems like the status field hasn't been populated on all fields. Can we assume that the status is 'active' then?
Was able to replicate this as well. Below are two screen shots, one a REST API request hitting the default "current" REST API version's endpoint. And another a GraphQL API request hitting the 2020-10 API version's endpoint. REST API doesn't include status, while I can specifically retrieve the status property for the same product.
@ClementBR reached out to me and we looked into this and realized these are cached responses from the Product API where your apps would have used older API versions.
There are a few options available here to fix the products:
- Patience for the cache to clear, and use a newer API version for all future calls so it doesn't happen again (no set timeframe for the cache expiry)
- Update a product with a 'blank' change to break the cache if you have access (a space in a product title generally works)
- Use GraphQL for your API calls, responses are not cached with GraphQL which is why you saw what you did @Greg_Kujawa
At any rate, once older API versions have been deprecated and are no longer in use this will no longer be able to happen as well.
I don't know if this is the whole story.
We have pulled products on one of our dev shops and last week we saw status on some of our products, but pulling earlier this week we saw fewer products with status, and today I don't see any products.
We have tried with multiple api versions and even api keys in all cases, by default we are currently on 2020-07, and outside trying last week we would not have used the other api versions in a while, so those responses probably would not have been cached.
Updating products or swapping to a newer api does not seem to push the status through to the response.
This is quite frustrating as status is something exposed to merchants via the admin panel, but we don't have access to it, so when merchants ask if they can action on it, we have to tell them we just don't have access as GraphQL is not something we have integrated.
The Product status field was added for the API version 2020-10 release according to this changelog. If you're using the 2020-07 version of the API, I believe this field would not be available in the response data returned and that's consistent with what you're experiencing. I would recommend using the latest supported version of our APIs in this case.
There might still be the issue of caching if you do bump your API version up as Josh explained in his post.
Hopefully this helps in clarifying this issue for you.