Solved

Shopify API - Metafield - deprecation header

DexG
Shopify Expert
5 0 2

We are encountering an issue where we are always receiving a X-Shopify-API-Deprecated-Reason header on every request we make for metafields on a shop. We have tried multiple scenarios of removing the metafields and re-creating the metafields while using the newest API version but we still receive the deprecated reason header. 

 

Based on this blog post the deprecated header should only appear if we are making a request with a deprecated API version. Link to blog: https://www.shopify.ca/partners/blog/api-deprecation

 

 

Ex) 

Created the metafields using REST API version 2022-01.

Grabbed the metafields using REST API version 2022-01. 

 

 

 

{
    "metafields": [
        {
            "id": 19989194702926,
            "namespace": "bold_rp",
            "key": "rp_group_id",
            "value": 4,
            "value_type": "integer",
            "description": null,
            "owner_id": 12399450718286,
            "created_at": "2021-12-10T10:09:54-05:00",
            "updated_at": "2021-12-10T10:09:54-05:00",
            "owner_resource": "variant",
            "type": "number_integer",
            "admin_graphql_api_id": "gid://shopify/Metafield/19989194702926"
        },
        {
            "id": 19989194735694,
            "namespace": "bold_rp",
            "key": "rp_subscription_only",
            "value": 1,
            "value_type": "integer",
            "description": null,
            "owner_id": 12399450718286,
            "created_at": "2021-12-10T10:09:54-05:00",
            "updated_at": "2021-12-10T10:09:54-05:00",
            "owner_resource": "variant",
            "type": "number_integer",
            "admin_graphql_api_id": "gid://shopify/Metafield/19989194735694"
        }
    ]
}

 

 

 

 

My understanding is that the metafield API should not return the `value_type` field after API version 2021-07 based on a response from this past post: https://community.shopify.com/c/shopify-apis-and-sdks/what-happens-to-legacy-metafields-created-with...

 

Also this request still received the X-Shopify-API-Deprecated-Reason header
X-Request-ID: e3695196-1b4d-45cc-9cf0-40cdccf4b873

X-Shopify-API-Deprecated-Reason: https://shopify.dev/changelog/online-store-2-0-new-metafields-type-system-and-dynamic-sources

We are looking for a way to stop receiving the X-Shopify-API-Deprecated-Reason. 

 

Is the X-Shopify-API-Deprecated-Reason getting sent on purpose for some reason? If so what is the reason?

Accepted Solution (1)

Luke_K
Shopify Staff
402 66 100

This is an accepted solution.

Hey @DexG 

 

Thanks for raising this -  to alleviate any concerns, I've confirmed with the Metafields team that as long as you've updated the calls, and are not setting value_type when creating/editing nor consuming value_type coming back in the response, the reference to this specific deprecation in x-shopify-api-deprecated-reason can safely be ignored in this case. 

 

I can see that this has has gone into our development team's pipeline for action and I hope this explains further  - I can acknowledge that the docs are a little confusing in this regard and any further updates will be communicated in the Shopify Community forums.

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 4 (4)

Luke_K
Shopify Staff
402 66 100

This is an accepted solution.

Hey @DexG 

 

Thanks for raising this -  to alleviate any concerns, I've confirmed with the Metafields team that as long as you've updated the calls, and are not setting value_type when creating/editing nor consuming value_type coming back in the response, the reference to this specific deprecation in x-shopify-api-deprecated-reason can safely be ignored in this case. 

 

I can see that this has has gone into our development team's pipeline for action and I hope this explains further  - I can acknowledge that the docs are a little confusing in this regard and any further updates will be communicated in the Shopify Community forums.

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
DexG
Shopify Expert
5 0 2

Thanks @Luke_K .

Balouchi
Excursionist
44 0 8

App must set security headers to protect against click jacking.
Your app must set the proper frame-ancestors content security policy directive to avoid click jacking attacks. The 'content-security-policy' header should set frame-ancestors https: //[shop]. myshopify.com https://admin.shopify.com, where [shop] is the shop domain the app is embedded on.

DexG
Shopify Expert
5 0 2

Thanks for the information @Balouchi but I'm not sure how that information relates to my questions about the deprecation header appearing when it shouldn't. Does setting the security headers prevent the deprecation header from appearing?