Create metafield returns error must be a valid link

Hi Guys,

I am trying to POST metadata to an order but I am getting an error

{"errors":{"value":["must be a valid link."]}}

My JSON body request:

{"metafield": {"namespace": "affiliate", "key": "affiliate_id", "type": "link", "value": {"text": "Affiliate #xxxx", "url": "https://affiliates.healthnutrition.com/affiliates/xxxx"}}}

Posting to:

/admin/api/2024-07/orders/{{ order_id }}/metafields.json

This all looks correct according to: https://shopify.dev/docs/apps/build/custom-data/metafields/list-of-data-types

So I am confused, what is wrong with my request?

Hi @meslack

type : url Does it meet your needs?

{
    "metafield": {
        "namespace": "affiliate",
        "key": "affiliate_id",
        "type": "url",
        "value":"https://google.com"
        
    }
}

It’s OK.. but I would prefer a link, it’s in the documentation, so it should work.

I emailed technical support and they are making me jump through A LOT of hoops just to have them fix their own API… annoying…