Product Listings REST API returns "Not Found"

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 am trying to maintain a list of sales channels each of the products in our Shopify store are in. What is the best approach? Which API endpoint should I hit to either:

  • Pass a product and see the sales channels the product is in
  • Pass a sales channel and see the products that are in it?

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!

1 Like

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" }

Calls to: https://[my shopify url]/admin/api/2023-07/sales_channels.json

Return:

{ "errors": "Not Found" }

I’m uncertain why you believe that these are valid REST API endpoints, but if they are, I’m missing something to be able to find them. Are you certain these endpoints exist and will provide the information I’m looking for?

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.