Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel1
maxLevel3

Making a Request

First, there are some steps in Postman that need to be done before writing a request.

...

To have Postman give suggestions for your query, press Ctrl + Space to bring up the autocomplete box.

...

Writing a Query

After you have created a request and loaded the schema, we can start to write our query. There are a few key parts to a query which we’ll dive into with the example below.

...

There are three main variables to use with that are common across most FlexDeploy GraphQL queries: where, sort, and page.

Variable Name

Description

Object Definition

where: [WhereInput]

This allows you to filter the data like a where clause in an SQL query. Where is an array so multiple individual WhereInput objects can be linked together to filter the query.

field: Name of the GraphQL field being filtered

type: The comparison being performed

eq - equal

ne - not equal

eqi - equal (Ignores Case)

gt - greater than

lt - less than

inc - includes

inci - includes (Ignores Case)

ninc - does not include

empty - empty

nempty - not empty

innerWhere: Similar to a subselect in SQL where prefiltering of a query could be done

value: The value you are filtering by

Code Block
languagejson
input WhereInput {
  field: String!
  type: WhereTypeEnum!
  innerWhere: [WhereInput!]
  value: String
}

enum WhereTypeEnum {
  eq
  ne
  eqi
  gt
  lt
  inc
  inci
  ninc
  empty
  nempty
}

sort: [SortInput]

This allows you to sort the data like a order by clause in an SQL query. Sort is an array so multiple individual SortInput objects can be linked together to sort the query.

field: GraphQL field being sorted

direction: the direction of sort being preformed with asc meaing meaning ascending order and desc meaning descending order.

Code Block
languagejson
input SortInput {
  field: String!
  direction: SortEnum
}

enum SortEnum {
  asc
  desc
}

page: PageInput

Page input contains extra options for the block of data that is returned by the query.

limit: The number of items in the block being returned. By default, a limit of 50 items are returned by the query. This can be overridden by the page limit to return a different amount of items.

offset: Offsets the block of data being returned by the set value. For example, a limit of 20 and an offset of 4 would return items 4 through 23.

Code Block
languagejson
input PageInput {
  limit: Int
  offset: Int
}

...

All of the above variables object above objects are then bundled together in one variable object. It is not required to always include all three variables in the object. For example, if you wanted to only filter and not sort, you would only need to include the where variable. Below is an example of the combined variable object with all three variables used.

...

Combining everything we talked about this thus far (creating a HTTP Request, queries, and variables), we are now able to execute a query.

...

...

Response

Code Block
{
    "data": {
        "reportEnvironmentState": {
            "items": [
                {
                    "packageName": null,
                    "projectName": "RESTDeployProject1",
                    "projectVersionName": "1.0.30566"
                },
                {
                    "packageName": null,
                    "projectName": "RESTDeployProject1",
                    "projectVersionName": "1.0.30577"
                },
            ]
        }
    }
}

Example Queries

Here are are few more examples of GraphQL queries. See Fetching Schema and Introspection above for information on how to get our full schemaschema for a full listing of available queries and mutations.

Environment History Report

...

with File Details

This is running the same query used by the Environment History Report with the Show File Details checkbox selected. It is querying the history of all FlexDeploy executions against an environment called “Build” with file-level details being returned. We have a where variable below being used to only filter for the Build environment, as well as a page variable to limit the response to only the first two items.

Code Block
query reportHistoryFiles($where: [WhereInput], $sort: [SortInput], $page: PageInput) {
    reportEnvironmentHistoryFileDetails(where: $where, sort: $sort, page: $page) {
        items {
            allFilesRequested
            cmsTicketIds
            endTime
            environmentId
            environmentName
            executionStatus
            folderId
            instanceId
            instanceName
            workItemIds
            objectPath
            packageName
            partialDeployments
            pkgStatus
            poScmRevision
            projectId
            projectName
            projectVersionName
            relDefinitionId
            relName
            relSnapshot
            relSnapshotId
            requestedBy
            requestedOn
            scmRevision
            sequenceNumber
            stageExecId
            startTime
            streamName
            workflowExecutionId
            workflowId
            workflowRequestId
            workflowType
            workflowVersion
        }
    }
}

...

Code Block
{
    "data": {
        "reportEnvironmentHistoryFileDetails": {
            "items": [
                {
                    "projectName": "RESTDeployProject1",
                    "environmentName": "Build",
                    "instanceName": "Project Rest Test Instance 1",
                    "workflowExecutionId": 6114897,
                    "executionStatus": "Success",
                    "workflowType": "DEPLOY",
                    "streamName": "trunk",
                    "projectVersionName": "1.0.30577",
                    "packageName": "",
                    "objectPath": null,
                    "objectType": null,
                    "poScmRevision": null,
                    "projectId": 759143,
                    "subComponentName": null,
                    "subComponentType": null,
                    "requestedOn": 1683228165127,
                    "pkgStatus": null,
                    "partialDeployments": "N",
                    "sequenceNumber": null,
                    "stageExecId": null,
                    "relName": null,
                    "relSnapshot": null,
                    "relStatus": null,
                    "environmentId": 10050,
                    "instanceId": 45664,
                    "scmRevision": null,
                    "workItemIds": null,
                    "cmsTicketIds": null,
                    "startTime": 1683228167140,
                    "endTime": 1683228167234,
                    "duration": 94,
                    "folderId": 759142,
                    "folderName": "SoapUI Testing",
                    "workflowName": "Deploy No Action",
                    "relDefinitionId": null,
                    "relSnapshotId": null,
                    "pipelineName": null,
                    "workflowId": 83363,
                    "workflowRequestId": 1190158,
                    "workflowVersion": "1.2"
                },
                {
                    "projectName": "RESTDeployProject1",
                    "environmentName": "Build",
                    "instanceName": "Project Rest Test Instance 1",
                    "workflowExecutionId": 6114898,
                    "executionStatus": "Success",
                    "workflowType": "DEPLOY",
                    "streamName": "trunk",
                    "projectVersionName": "1.0.30577",
                    "packageName": "",
                    "objectPath": null,
                    "objectType": null,
                    "poScmRevision": null,
                    "projectId": 759143,
                    "subComponentName": null,
                    "subComponentType": null,
                    "requestedOn": 1683228163189,
                    "pkgStatus": null,
                    "partialDeployments": "N",
                    "sequenceNumber": null,
                    "stageExecId": null,
                    "relName": null,
                    "relSnapshot": null,
                    "relStatus": null,
                    "environmentId": 10050,
                    "instanceId": 45664,
                    "scmRevision": null,
                    "workItemIds": null,
                    "cmsTicketIds": null,
                    "startTime": 1683228167138,
                    "endTime": 1683228167218,
                    "duration": 80,
                    "folderId": 759142,
                    "folderName": "SoapUI Testing",
                    "workflowName": "Deploy No Action",
                    "relDefinitionId": null,
                    "relSnapshotId": null,
                    "pipelineName": null,
                    "workflowId": 83363,
                    "workflowRequestId": 1190157,
                    "workflowVersion": "1.0"
                }
            ]
        }
    }
}

Environment History Report

...

without File Details

This is querying the history of an environment called “Development” with file details not being returned.

...