Get list of instance deployed via GraphQL Api

Below query will fetch the list of Instance deployed, which is shown under services tab :

{
instances(limit: 10) {
pageInfo {
total
}
nodes {
… on K8sPodInstance {
containers {
containerId
image
name
}
environment{
name

    }
    podName
  }
  artifact{
    artifactSource {
      name
    }
    buildNo
  }
}

}
}

Here in above example we have used K8sPodInstance, but you can also use PhysicalInstance, PcfInstance etc.
You can also filter on particular environment as well

query {
instances(limit: 10, filters : [{
environment: { operator: EQUALS, values: [“env-id”] },
}
]) {
pageInfo {
total
} nodes…

2 Likes