Closed JordanDysart closed 2 years ago
I cannot reproduce the issue:
$ cat gh-539.mjs
import Shopify from 'shopify-api-node';
const shopify = new Shopify({
shopName: 'quuz',
apiVersion: '2021-01',
apiKey: 'b68c3a4bf44cd240511e5f4114f0be4d',
password: '2d170167fc62551920ca60fe40a5e548'
});
const products = await shopify.product.list({
fields: 'template_suffix, handle, title'
});
console.log(products);
$ node gh-539.mjs
[]
Also, it does not make much sense. url.search
and url.query
are two different things.
$ node
Welcome to Node.js v18.2.0.
Type ".help" for more information.
> url.parse('http://example.com/?foo=bar')
Url {
protocol: 'http:',
slashes: true,
auth: null,
host: 'example.com',
port: null,
hostname: 'example.com',
hash: null,
search: '?foo=bar',
query: 'foo=bar',
pathname: '/',
path: '/?foo=bar',
href: 'http://example.com/?foo=bar'
}
@lpinca thanks for pointing that out. I've been tricked by my own inexperience. The got docs were very helpful.
It looks like my issue is in my own code, I've been updating some old tools that were written before Shopify switched to cursor based pagination. page
is no longer supported.
https://shopify.dev/api/usage/pagination-rest
And! you already covered in the docs that I skimmed past.
https://github.com/MONEI/Shopify-api-node#pagination
Thanks, looks like this isn't an issue.
Ok, I'm closing this then.
When trying to query shopify for a list of products and the templates that they were using I was receiving an error as a response from Shopify.
This request
Would result in this error.
I resolved the issue by changing this function found in file
Shopify-api-node/mixins/base.js
.The line
url.search = '?' + qs.stringify(query, { arrayFormat: 'brackets' });
was updated tourl.query = '?' + qs.stringify(query, { arrayFormat: 'brackets' });
. (i.e search changed to query).Would it make sense to create a pull request to change this? I'm not 100% familiar with the entire API, so I cannot confirm if this issue pops up while using other endpoints.