37 lines
673 B
JavaScript
Executable File
37 lines
673 B
JavaScript
Executable File
const axios = require('axios');
|
|
|
|
const SHOP = 'veloxautomotive.myshopify.com';
|
|
const ACCESS_TOKEN = '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';
|
|
|
|
const query = `
|
|
{
|
|
products(first: 5) {
|
|
edges {
|
|
node {
|
|
id
|
|
title
|
|
status
|
|
createdAt
|
|
handle
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
axios.post(
|
|
`https://${SHOP}/admin/api/2023-10/graphql.json`,
|
|
{ query },
|
|
{
|
|
headers: {
|
|
'X-Shopify-Access-Token': ACCESS_TOKEN,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
}
|
|
)
|
|
.then(response => {
|
|
console.log(JSON.stringify(response.data, null, 2));
|
|
})
|
|
.catch(error => {
|
|
console.error(error.response ? error.response.data : error.message);
|
|
}); |