Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't retrieve metafields for blog articles #1020

Open
tomkastek opened this issue Sep 2, 2019 · 4 comments
Open

Can't retrieve metafields for blog articles #1020

tomkastek opened this issue Sep 2, 2019 · 4 comments

Comments

@tomkastek
Copy link

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
Copy link
Contributor

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

@tomkastek
Copy link
Author

tomkastek commented Sep 3, 2019

@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
Copy link
Contributor

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants