Closed weirdian2k3 closed 1 year ago
Thanks for the PR! I'm a bit busy this week but I'll try to review it in the next couple of days.
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
33479a2
) 100.00% compared to head (24e796a
) 100.00%.:exclamation: Current head 24e796a differs from pull request most recent head 94d3d6b. Consider uploading reports for the commit 94d3d6b to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@weirdian2k3 Hello Ian, Thank you for creating this endpoint. However, the example above is not working in my case. I get the error "unacceptable". Maybe you stumbled across a similar error?
func GraphQLTest(c echo.Context) error {
// Get Access Token
t, err := utils.GetAccessToken(c)
if err != nil {
fmt.Printf("Error: %s\n", err.Error())
return c.String(500, "Token Error")
}
fmt.Printf("Token: %s\n", t.Token)
// Endpoint Test
client := goshopify.NewClient(utils.ShopifyApp, t.Shopname, t.Token)
req := `mutation webPixelCreate($webPixel: WebPixelInput!) {
webPixelCreate(webPixel: $webPixel) {
userErrors {
code
field
message
}
webPixel {
settings
id
}
}
}`
settings, err := json.Marshal(map[string]interface{}{
"accountID": fmt.Sprintf("%d", 12121324),
})
if err != nil {
fmt.Printf("Error: %v\n", err.Error())
return c.String(500, " Error")
}
variables := map[string]interface{}{
"webPixel": map[string]interface{}{
"settings": string(settings),
},
}
var foo struct {
}
err = client.GraphQL.Query(req, &variables, &foo)
if err != nil {
fmt.Printf("Error: %v\n", err.Error())
return c.String(500, " Error")
}
return c.Render(http.StatusOK, "hello.html", map[string]interface{}{})
}
Same for me, even for simple examples like { shop { name } }}
i do get a Not Acceptable
response
@nickfthedev i think i found it. You should set an explicit version with goshopify.WithVersion("2024-04")
. The graphql api does not allow a path myshopify.com/admin/api/graphql.json
but myshopify.com/admin/api/2024-04/graphql.json
This is a re-introduction of an old PR by another person, trimmed down to just the GraphQL Client and a typo-fix https://github.com/bold-commerce/go-shopify/pull/118
I'm not sure why the original one got closed, but I've succeessfully used it for making mutations with queries