How it works: CMCI GraphQL API
The CICS management client interface (CMCI) provides a GraphQL application programming interface (API) for system management clients such as IBM® CICS Explorer®. The CMCI GraphQL API is supported through HTTP. With the GraphQL API, a client can query many types of CICS® resources across CICSplexes in a single request. In the single query request, the client can specify exactly what data it needs about multiple CICS resources, with explicitly expressed inherent relationships between the CICS resources.
The aggregation function in CICS Explorer 5.5 requires the CMCI GraphQL API. The CMCI GraphQL API requires the CMCI JVM server to be used with the CMCI. For more information about GraphQL, see Introduction to GraphQL.
What is a GraphQL query?
{
cicsplexes {
name
}
}
At the root of the query is the cicsplexes field, which finds all the CICSplexes
that the WUI server is connected to. The name field nested in the
cicsplexes field requests the name of each CICSplex.
data field. The structure of the response follows that in the query.{
"data": {
"cicsplexes": [
{
"name": "CICSPLX01"
},
{
"name": "CICSPLX02"
}
]
}
}
To retrieve more information, add more fields to the query, including nested ones. See Sample queries.
How to make GraphQL API requests
https://host:port/graphqlwhere
host and port are the host name and the port number of your
CMCI JVM server.- For GET requests:
-
A
Content-Type: application/jsonheader must be sent. The query is supplied by thequeryquery parameter. The operation is supplied by the optionaloperationNamequery parameter.For example, the simple query in Figure 1 can be sent by using the following URL:https://host:port/graphql?query={cicsplexes{name}} - For POST requests:
-
A
Content-Type: application/jsonheader must be sent. The body of the request must be a JSON-encoded object.
where only the{ "query": "query_body", "operationName": "operation_name" }queryfield is mandatory.Alternatively, a
Content-Type: application/graphqlheader can be sent on POST requests. In this case, the body of the request must be the GraphQL query itself, and no operation name can be specified.
See Sample queries for sample code of GraphQL queries.
Sample queries
https://host:port/graphiqlwhere host
and port are the host name and the port number of your CMCI JVM server. - GraphiQL provides auto-completion and a built-in documentation explorer for GraphQL schema reference. You can display available field names by pressing Ctrl+Space.
- To easily differentiate queries in GraphiQL history, you can specify a unique query name by
prefixing the query with
query QueryName.
LocalFilesInRegionsInCICSplexes.query LocalFilesInRegionsInCICSplexes {
cicsplexes {
name
regions {
name
cicsResources {
locfile {
count
}
}
}
}
}name,
useCount, and status fields of all the local
transactions.{
cicsplexes {
name
regions {
name
cicsResources {
loctran {
records {
name
useCount
status
}
}
}
}
}
}name, useCount, and
status fields of all the local transactions in the
region.{
cicsplex(name: "PLEX1") {
name
region(name: "AORRGN") {
name
cicsResources {
loctran {
records {
name
useCount
status
}
}
}
}
}
}name, useCount, and status fields of all
the local transactions in those
CICSplexes.{
cicsplexes {
name
cicsResources {
loctran {
records {
name
useCount
status
}
}
}
}
}CED.{
cicsplexes {
name
cicsResources {
loctran(filter: {name: {value: "CED*"}}) {
records {
name
useCount
status
}
}
}
}
}{
cicsplex(name: "PLEX1") {
drep {
cicsDefinitions {
filedef {
records {
name
update
}
}
}
}
}
}{
cicsplex(name: "PLEX1") {
region(name: "AORRGN") {
csd {
cicsDefinitions {
pipedef {
records {
name
}
}
}
}
}
}
}readCount
within each
group.{
cicsplexes {
name
cicsResources {
locfile {
groupBy(attribute: "name") {
count
aggregateRecord {
name {
value
}
readCount {
average
min
max
}
}
}
}
}
}
}