Metafield keys: restrictions on special characters?

John_Hardin
Tourist
4 1 0

Folks:

We're getting a "metafields.key must be unique within this namespace on this resource" error attempting to update metafields on a product via the REST API.

The key values are indeed unique; however, they share a common prefix that contains an "&" character. For example:

  • mumble&mumble_key1
  • mumble&mumble_key2

Is this perhaps causing the key text after the "&" (the unique part) to be ignored?

Are there special characters which should not appear in metafield keys? There is no mention of such restrictions that I have found yet in the Metafields API documentation...

Or are there perhaps key length limitations that are truncating the keys before the unique part is reached?

Thanks!

0 Likes
PaulNewton
Shopify Partner
3135 196 578

Test Urlencoding the ampersands for a change in situation.

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
John_Hardin
Tourist
4 1 0

We can certainly try sanitizations, but needing something like UrlEncode() on the key value should be documented...

0 Likes