Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Metafield keys: restrictions on special characters?

Metafield keys: restrictions on special characters?

John_Hardin
Shopify Partner
12 1 8

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!

Replies 2 (2)

PaulNewton
Shopify Partner
7450 657 1565

Test Urlencoding the ampersands for a change in situation.

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


John_Hardin
Shopify Partner
12 1 8

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