FROM CACHE - en_header

How to get products with rest api

Ned3
Shopify Partner
2 0 0

Hi,

I'm trying to create a simple app which gets all products and to log the response using shopify's rest api from these docs - 

https://shopify.dev/api/admin-rest/2021-10/resources/product#get-products

 

I'm trying to do it using fetch function -

 async function test() {
    const t = await fetch("/products", {})
     console.log(t.text());
 }

But it returns nothing but a pending request.

Is there a better way to do this? 

Thank's

 

Replies 0 (0)