Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
This is an http post response to create a new shopify blog with metadata values.
blog := Blog{ Title: fileNameWithoutExtSliceNotation(doc.Name()), Template_suffix: "hit_parader_issue_template", Metafields: []BlogMeta{ { Key: "filter_tag_list", Value: "Popular", Type: "single_line_text_field", Namespace: "global", }, }, } blogJSON, err := json.Marshal(blog) blogReq, err := http.NewRequest("POST", newBlogQuery, bytes.NewBuffer(blogJSON)) blogReq.Header.Add("X-Shopify-Access-Token", TOKEN) blogReq.Header.Add("Content-Type", "application/json") resp1, err := client.Do(blogReq)
my structs are like below
type Blog struct { Title string `json:"title"` Template_suffix string `json:"template_suffix"` Metafields []BlogMeta } type BlogMeta struct { Key string Value string Type string Namespace string }
im getting an error saying
{"errors":{"blog":"Required parameter missing or invalid"}}
These are my blog metafield definitions.
I have all the necessary fields listed in the following api call. Please help.
Im using below API
https://shopify.dev/api/admin-rest/2022-10/resources/blog#post-blogs
NOTE: the API documentation says that I need to present a array for the metafields. But I think my code is correct. IS there something im missing? Any help would be appreciated.