How grab empty metafields in an API call

Hi!

I have a store with functionalities heavily reliant on products custom metafields. For a non-technical person, creating a product like that would be super difficult to fill out properly, so I want to create a base in airtable from where all correct information would be filled and then passed to shopify with an API call.

The problem is when metafields values are empty I cannot get their IDs. Using a method like ‘Retrieve a list of metafields by using query parameters’ returns an empty array. Similarly, i cannot get the metfields ids when I try to get them one by one. I saw on this forum that is a problem for other people as well, but found no answer…
Hacky way might be creating a default value for every metafield, then i could retrieve the IDs and override the values, but I do not know if that’s possible.

Has someone overcome this?

An empty metafield wouldn’t exist as it needs some value to create one.

If you’ve pulled all metafields on a product you’d know what ones exist though, and the values each contains.

Hi, thanks for responding. I’ve understood I have used inaccurate names to describe my problem. What I meant is I have metafield definitions in place and I want to populate those definitions but don’t know how to grab the definitions to put my data.

For anyone looking, the proper way to go about this is to use the Create Metafield method.

Maybe I misunderstood the solution. Tried “Create Metafield” method to provide a value for existing Metafield I got an error response “Namespace and key cannot be changed for an existing record. Try creating a new one.”

Updated: My bad! It works. Just was a uppercase mistype for metafield “key”