Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 199 forks source link

Can't retrieve metafields for blog articles #1020

Open tomkastek opened 5 years ago

tomkastek commented 5 years ago

Hey there,

I do not know if this is a bug or a feature request. That's why I am writing here.

I want to use the Shopify Storefront GraphQL API. I created some custom metafields for this. But while I build my query I found no option to get those blog article metafields with Storefront API.

First, the REST API request: "https://myapp.myshopify.com/admin/blogs/BLOG_ID/articles/ARTICLE_ID/metafields.json"

But with GraphQL there is no field metafields on an articleQuery. I tried it like:

static func allArticles() -> Storefront.QueryRootQuery {
        return Storefront.buildQuery { (queryRootQuery) in
            queryRootQuery.articles(first: 250, { (articleConnectionQuery) in
                articleConnectionQuery.edges({ (articlesEdgeQuery) in
                    articlesEdgeQuery.node({ (articleQuery) in
                        articleQuery.id().NO_METAFIELDS?
                    })
                })
            })
        }
    }

On products instead I can read the metafields on the position where I wrote NO_METAFIELDS? above. So do I need to use REST for this and have my code half written in REST and half written in GraphQL?

rebeccajfriedman commented 5 years ago

As per our Storefront API documentation, only Product and ProductVariant Metafields are supported at this time.

tomkastek commented 5 years ago

@rebeccajfriedman So there is no way to get blog article metafields with a mobile App?

The two solutions I think of:

  1. Use Admin API. Problem: Security. If I use Admin API I have to store login data in my application code. Is there any problem doing this if the only permission is read access on store content? Is there anything a user would not be able to read with Storefront API?

  2. Set up my own backend just to store metafield information I am going to read from.

rebeccajfriedman commented 4 years ago

At this time, those are your two available options. We are tracking this issue in our backlog, and we can update here once it is supported.

kemalbaynu3 commented 4 years ago

Hello @rebeccajfriedman, will the support be there anytime soon? Because I don't want to invest to another backend service just to retrieve a metafield, if this new backend is going to be obsolete in the next three months.