Getting content/entries of specific publishedVersion

In Contentful GraphQL playground, we have schema to query collection using where clause.

SysFilter has attribute to query by publishedVersion: Float but when I make following query

assetCollection(where: { sys: { id: "some-id", publishedVersion: 4 } }) {
    items {
      title
      sys {
        id
        publishedVersion
      }
    }
  }

it always returns me empty array

{
  "assetCollection": {
    "items": []
  }
}

Note: If I use publishedVersion of the latest version, it gives me data, but the problem is only if I try to get an older version.

Am I doing something wrong here?

Hi @shyamsundar.g,

Please follow the below steps:

  1. Make sure you are running the query on Master environment, because that is the place where the versions will be available.
  2. To check whether the versions available, try the below query first.
query{
  assetCollection{
    items{
      sys{
        publishedVersion
      }
    }
  }
}
  1. In case if you are getting the results for the above query something similar to below , then use one of the id details and run the query that you mentioned with the below id and version details
       {
          "sys": {
            "id": "XXXXXXXXXXXXXX",
            "publishedVersion": 4
          }
        },
        {
          "sys": {
            "id": "XXXXXXXXXXXXXX",
            "publishedVersion": 4
          }
        },

Adding the query for you again here.

query{
  assetCollection(where:{sys:{id:"XXXXXXXXXXX",publishedVersion:4}}){
    items{
      sys{
        publishedVersion
        id
      }
    }
  }
}

Hope this helps you