Query in GraphQL returns argumentNotAccepted

Hello,

I have the following query:

query MyQuery {
  priceList(id: "gid://shopify/PriceList/17287970890") {
    id
    prices(query: "variant_id:'40528948625482'", first: 1) {
      nodes {
        price {
          amount
          currencyCode
        }
        variant {
          id
        }
        compareAtPrice {
          amount
          currencyCode
        }
      }
    }
  }
}

In Shopify GraphiQL App gives me a correct result, without errors.

But by querying post from my application code it gives me the following error:

Field ‘prices’ doesn’t accept argument ‘query’, locations - line - 4, column - 14, path - query MyQuery, priceList, prices, query, extensions - code - argumentNotAccepted, name - prices, typeName - Field, argumentName

According to the documentation, the prices connection has “query” as an argument and also from the Shopify GraphiQL App it works.

Does anyone know what could be happening?

thank you so much!

Hi, there

You could check your api version usage of your code

As far as i see

In version2024-01 2024-04 and above it does has the query param

but in version 2023 version it does not have the param

Thank you Eric for your answer, but that can’t be the reason, since the app uses the latest stable version, 2024-04:

Hi, Vacune

May i ask which app you using?

Hi Eric,

I am using PHP Shopify SDK

Hi @Vacune ,

The most likely cause of that error message would be making the API call with a version lower than 2024-01, as that’s the version when the query filter got added to Pricelist.prices. This can be confirmed by adjusting the version number at the top left of the dev docs page for the object:

https://shopify.dev/docs/api/admin-graphql/2023-10/objects/PriceList#connection-prices

Looking at the screenshot you provided of the ‘Event Version’ selector, that only applies to things like webhooks that are sent out and not to live API calls being made.

The version used for live API calls is determined by what version is specified in the URL when each API call is being made, here’s the GraphQL Admin API endpoint docs which mention that:

https://shopify.dev/docs/api/admin-graphql#endpoints

When using a library it might not be clear what URL is being used for the API calls as the library handles it behind the scenes. However, we don’t provide direct support for the libraries so you’d want to check the docs from wherever you got the library for how to specify which API version is being used for the calls.

This is important because API version changes occur every 3 months so it’s recommended to keep up to date with the release notes and keep incrementing the API version called every quarter.

Here’s more info on API versioning in general and the release schedule, with the oldest served being a max of 1 year old:

https://shopify.dev/docs/api/usage/versioning

1 Like

thank you very very much!!!

I had not taken into account the call to the endpoint!! The post has helped me find the way to solve the problem.

Again, thank you very much!!