Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

GraphQL Admin Api Return Errors For Fields That Exist On Resource As Per Documentation

sanketJ
Shopify Partner
18 0 1

I am using shopify graphQL admin api and I get errors like [field] doesn't exist on type [resource] though they exist according to graphQL admin api documentation as you can see below 

 

sanketJ_0-1646721940148.png

and errors as well

 

sanketJ_1-1646721953582.png

Any insights would  be appreciated

 

Accepted Solution (1)

c10s
Shopify Partner
67 12 24

This is an accepted solution.

Images are paginated so you need to do it like this: (you can change 10 to whatever you want)

mutation productCreate($input: ProductInput!) {
  productCreate(input: $input) {
    product {
      id
      images(first: 10) {
        edges {
          node {
            id
          }
        }
      }
    }
    shop {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

View solution in original post

Reply 1 (1)

c10s
Shopify Partner
67 12 24

This is an accepted solution.

Images are paginated so you need to do it like this: (you can change 10 to whatever you want)

mutation productCreate($input: ProductInput!) {
  productCreate(input: $input) {
    product {
      id
      images(first: 10) {
        edges {
          node {
            id
          }
        }
      }
    }
    shop {
      id
    }
    userErrors {
      field
      message
    }
  }
}