Create metafield returns error must be a valid link

Create metafield returns error must be a valid link

meslack
Visitor
3 0 0

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?

Replies 2 (2)

Kyle_liu
Shopify Partner
164 23 27

Hi @meslack 

 

type : url Does it meet your needs?

 

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

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on (liushuaicc@shinetechsoftware.com)
meslack
Visitor
3 0 0

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...