Hey @Zona thanks for posting a question on the forums! As @Jason mentioned above, you can paginate your requests to the REST API using the response headers on your request.
Specifically, you want to iterate over the pages of your request. There, you’ll see some URL parameters that you can use like “limit” and “page_info” – I wouldn’t suggest increasing the limit because you’ll risk timing out your requests. Instead, use the page_info parameter to go to the next page of metafields until you’ve found the right one.
You can also filter the metafields that you request using the following URL parameters:
“namespace”
“key”
“type”
“created_at_min” (by providing a date)
“created_at_max”
“updated_at_min”
“updated_at_max”
For example, you can get shop metafields with the namespace “Shopify” that were created on or after January 1st, 2021, with the following URL:
@stratify Hello Stratify, I’d like to ask a question.
You can also filter the metafields that you request using the following URL parameters:> > For example, you can get shop metafields with the namespace “Shopify” that were created on or after January 1st, 2021, with the following URL:> > /admin/api/2021-07/metafields.json?limit=50&namespace=Shopify&created_at_min=2021-01-01
Is it able to filter “Shop” type by using namespace and key?
I couldn’t filter the metafields by URL parameters.
Also, I’m using “/admin/api/2021-07”.
This is my code.
import Shopify from '@shopify/shopify-api';
const client = new Shopify.Clients.Rest('your-development-store.myshopify.com', accessToken);
const res = await client.get({
path: 'metafields',
query: {"metafield%5Bnamespace%5D":"grobal","metafield%5Bkey%5D":"test"},
});
console.log("getSettingsFromApi res: ");
console.dir(res, { depth: null });
Hi @ken001 – can I suggest posting a new question if you’re still having issues? It helps everyone in the Community when we have one question per thread.
Be sure to double check that you’re querying the right details, including shop URL, access token, and URL parameters. For example, your code is querying for the namespace “grobal” when you probably want “global” – hope that helps! If not, feel free to tag me on a new question.
Hi @Zeesh the original issue has been resolved. Please create a new issue on the Community Forums.
You’re more likely to get an answer if you provide more context on your question. Be sure to provide text examples instead of screenshots, and feel free to tag me in the new post and I’ll do my best to help