type Shopify = {
token: string;
store_name: string;
};
/**
* Retrieve <code>product_ids</code> that are published to your app
* Retrieve product_ids that are published to your app. Maximum 1,000 results per page. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
limit: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/product_listings/product_ids.json`
);
for (const [k, v] of [["limit", limit]]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 337 days ago
type Shopify = {
token: string;
store_name: string;
};
/**
* Retrieve <code>product_ids</code> that are published to your app
* Retrieve product_ids that are published to your app. Maximum 1,000 results per page. Note: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the page parameter will return an error. To learn more, see Making requests to paginated REST Admin API endpoints.
*/
export async function main(
auth: Shopify,
api_version: string = "2023-10",
limit: string | undefined
) {
const url = new URL(
`https://${auth.store_name}.myshopify.com/admin/api/${api_version}/product_listings/product_ids.json`
);
for (const [k, v] of [["limit", limit]]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-Shopify-Access-Token": auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 883 days ago