Focusing on managing products, variants, and collections through the API.
I'm making a call to:
https://[my shopify url]/admin/api/2023-07/product_listings.json
But the response comes back with:
{ "errors": "Not Found" }
I'd prefer to keep it simple and use the REST API's instead of giving myself a brain aneurysm struggling with the GraphQL APIs.
Hi Pegarm,
It's possible that this error is appearing if your app doesn't have the required access scopes for the call - are you sure you have the `product_listings` access scope?
To get a list of all product listings that are available to a particular sales channel, you can use the product_listings.json endpoint as you're doing. This will return a list of all products that are published to the app/ sales channel. To get a list of all sales channels a particular product is published to, you can use `GET /admin/api/2023-07/products/#{product_id}/publication_details.json`
and replace #{product_id} with the ID of the product you're interested in.
To get a list of all sales channels, you can use `GET /admin/api/2023-07/sales_channels.json` as the endpoint. This will give you a list of all sales channels and you can then iterate over this list and fetch products for each sales channel using the `product_listings.json` endpoint mentioned above.
Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
There is no `product_listings` scope and there is no `GET /admin/api/2023-07/sales_channels.json` at least I get errors.
But I have `read_product_listings` scope according to https://shopify.dev/docs/api/usage/access-scopes
Hi Liam. I've made sure that the API key I'm using has full access to everything in Shopify. (I'll be locking this down afterwards, but I wanted to make sure credentials weren't the problem here.)
Calls to: https://[my shopify url]/admin/api/2023-07/products/[product ID]/publication_details.json
Return:
{ "errors": "Not Found" }
{ "errors": "Not Found" }
I have the same problem using official shopify php library version 2023_07.
I state that the credentials and settings used are correct as I use other methods of the library successfully.
As per the documentation I try to obtain the product count like this:
$products_count = ProductListing::count(
$this->session_api, // Session
[], // Url Ids
[], // Params
);
The response I get is << REST request failed: "Not Found" >>
I searched the official documentation and I realized that the access scope "product_listings" does not exist, it is not present in the list of selectable access scopes.
If this functionality is unusable, I kindly ask for an alternative method to recover the desired information
Basically this is not an issue,
Here is my implementation
I add an access scope read_product_listings with other scopes in my app code.
If you pass a product Id in the API and that product is listed on your app (sales channel app). then API return product data as per API documentation. And if that product is not listed into your sales channel then API simply throw a 404 or Not Found Error.