I created a new metafield in the product section, however when I use API to extract, I cannot find the metafield out. How can I extract the custom metafield out, thanks.
In the old days, Metafields were resources you attached to objects like Products, and anyone could modify them. It was anarchy! I could create a Metafield, and some Joe Blow with an API key could alter it, remove it, or replace it with sex toys or bad poetry.
These days, Shopify made an effort to limit that kind of damage by first of all ensuring that your API can only deal with Metafields made by your API key! So that limits collateral damage. Also, if you look closely at the API now, you'll see things like private Metafields. One can make Metafields visible or not.
So to answer your question requires you to shed some more light. You say you created a new Metafield. How do you do that? When you say you use the API to extract it, what does that mean? Can you provide at least some details about this process. Clearly, no one can help you till you do, as the subject is far more complex today than it used to be even a year or two ago.
There's the option in the settings, I use it to create metafield. Also, you mentioned that private metafield can be created, is that using api also?
Think about it this way. If you used the Admin to create a Metafield, in the Settings -> Metafields, say on a Product. And then you proceeded to edit the Product, and add some value to that Metafield, do you think it is appropriate that some API key can then read that Metafield?
Imagine, some App has permission to read/write products, so as to say, update inventory. OK. Great! Now, the merchant made a super important, vital Metafield, in the Admin, for their own internal use, attached to the product. Let us say that App developer is a bad actor. They use the power of their API key to examine the Metafields made in the Admin!
Do you see how that could be a problem? Hence, Shopify now says, hey, if you want to play with Metafields, you only get to play with the ones made by your API key.
Basically, if you want to use the API to play with Metafields, you create them with your API key, edit them in Shopify Admin, and play with them using the API after the fact, as you wish. You cannot just create them in the Admin, and then play with them using an API key.
Same pattern for Webhooks. If you create a webhook in the Admin, you cannot see it with an API key. If you want to play with webhooks and your API key, you must create them in the first place with your API key, then you can play with them.