We are creating Customer and metafields using POST to insert customer and metafield. When we get response from Shopify admin REST Api, we only receiving Customer id but not metafield Ids. is there any way to get metafield Ids while performing the POST?
Now we have a scenario where we might need to update Customer information along with Metafields (we have roughly around 40 to 50 Metafields)
We can update Customer information using PUT but metafields does nt get updated. As per documentation provided by Shopify, we have to send Metafield Id. Though we can make a query call to get the metafield IDs but PUT method for metafields does not support mass update which means we have to perform PUT with each individual metafield which means 40 + API Calls. This is not a good practice from Salesforce side.
Any other approach shopify team can suggest or can I get Metafield id also along with Customer ID in POST request?
When creating a customer with associated metafields, the Shopify API returns an ID for the newly created customer, but does not provide metafield IDs in the response in REST.
One possible solution is to use the GraphQL API to perform a bulk update of metafields for a customer. Specifically, you can use the customerUpdate mutation to update a customer and also include a metafields field to update all of the customer’s metafields in a single request. Here’s an example mutation for updating a customer’s first name, last name, and metafields:
Generally, any time that you use GraphQL you’ll have an easier time of updating resources in bulk. It’s especially easier to work with Metafields in GraphQL.