Reference: Gateway examples for Patch

Tanium Gateway provides a GraphQL API integration point for Tanium solutions, including Patch. Patch requests require Patch 3.16.191 or later to create, retrieve, and stop Patch deployments.

For additional Gateway example syntax, see Reference: Filter syntax and Reference: Gateway examples.

Patch query filter syntax

Patch queries to retrieve patch definitions support the following filter field:

  • cveIds

  • classification

  • hasCve

  • isSuperseded

  • platform

  • product

  • releasedOnOrBeforeDate

  • releasedOnOrAfterDate

  • severity

For more information on syntax, see patchDefinitionFieldFilter in the Documentation Explorer pane of the query explorer.

CVE ID

You can filter patch definitions based on an associated CVE ID. Define a filter object using the syntax:

JSON
{cveIds: [cve-id]}
Note: The filter supports one, and only one, CVE ID to filter the returned patch definitions.

For example, the following request filters and returns only patch definitions with a CVE ID of CVE-2014-123456:

JSON
query exampleGetPatchDefinitions ($first: Int, $filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (first: $first, filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "first": 1,
  "filter": {"cveIds": ["CVE-2014-123456"]},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Classification

You can filter patch definitions based on a patch definition classification. Define a filter object using the syntax:

JSON
{classification: classification-type}

For example, the following request filters and returns only patch definitions with a classification of Security Updates:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"classification": ["Security Updates"]},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Has association with any CVE

You can filter patch definitions based on whether the patch definition is associated with any CVE. Define a filter object using the syntax:

JSON
{hasCve: boolean-value}

For example, the following request filters and returns only patch definitions associated with any CVE:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"hasCve": true},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Is superseded by another patch definition

You can filter patch definitions based on whether the patch definition is superseded by another patch definition. Define a filter object using the syntax:

JSON
{isSuperseded: boolean-value}

For example, the following request filters and returns only patch definitions superseded by another patch definition:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"isSuperseded": true},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Operating System platform

You can filter patch definitions based on whether the patch definition applies to an operating system. Define a filter object using the syntax:

JSON
{platform: PatchEndpointPlatform-enum-value}

Supported values include MACOS, LINUX, and WINDOWS.

For example, the following request filters and returns only patch definitions that apply to Linux operating systems:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"platform": "LINUX"},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Product

You can filter patch definitions based on the product to which the patch definition applies to an operating system. Define a filter object using the syntax:

JSON
{product: product-name}

For example, the following request filters and returns only patch definitions for Windows Server 2019:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"product": "Windows Server 2019"},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Released on or before a date

You can filter patch definitions based on the patch definition release date occurring prior to or equal to a date in ISO 8601 format. Define a filter object using the syntax:

JSON
{releasedOnOrBeforeDate: iso-8601-date}

For example, the following request filters and returns only patch definitions released before or on December 31, 2020:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"releasedOnOrBeforeDate": "2020-12-31"},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Released on or after a date

You can filter patch definitions based on the patch definition release date occurring on or after a date in ISO 8601 format. Define a filter object using the syntax:

JSON
{releasedOnOrAfterDate: iso-8601-date}

For example, the following request filters and returns only patch definitions released on or after December 31, 2023:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"releasedOnOrAfterDate": "2023-12-31"},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Severity

You can filter patch definitions based on the patch definition severity. Define a filter object using the syntax:

JSON
{severity: severity-value}

The filter comparison is case-insensitive. Supported severity values include critical, important, low, medium, moderate, and none

For example, the following request filters and returns only patch definitions assigned a medium severity:

JSON
query exampleGetPatchDefinitions ($filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions (filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
		classification
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "filter": {"severity": "medium"},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Create a Patch install deployment for Linux

mutation.patchCreateDeployment

Create a Linux patch deployment

The patchCreateDeployment mutation requires Patch 3.16.191 or later and the Patch Deployment Write and Patch Deployment Execute permissions.

Note: The patchCreateDeployment mutation does not support uploading images to pre-install and post-install user notifications.

The following mutation creates a new deployment for installing Linux patches on targeted endpoints.

JSON
mutation exampleCreateLinuxPatchDeployment($input: PatchCreateDeploymentInput!) {
  patchCreateDeployment(input: $input) {
    deployment {
      id
      author {
        id
        displayName
        username
      }
      contentDeploymentType
      contentSet {
        id
      }
      createdTime
      description
      downloadImmediately
      name
      notifications {
        postDeployment {
          body
          countdownToDeadline {
            nanoseconds
            seconds
          }
          notificationPeriodDuration {
            nanoseconds
            seconds
          }
          postponeOptions {
            durationOne {
              nanoseconds
              seconds
            }
            durationTwo {
              nanoseconds
              seconds
            }
            durationThree {
              nanoseconds
              seconds
            }
          }
          title
          translations {
            body
            languageCode
            title
          }
        }
      }
      overrideBlocklists
      patches {
        id
      }
      patchLists {
        id
        version
      }
      platform
      restart
      schedule {
        distributeOver {
          nanoseconds
          seconds
        }
        endTime
        eussAvailableBeforeStart
        eussHideFromActivity
        overrideMaintenanceWindows
        startTime
        timeZone
        type
      }
      status
      stoppedTime
      targets {
        computerGroups {
          id
        }
      }
      type
      updatedTime
    }
    error {
      message
      retryable
      timedOut
    }
  }
}

Include the input variables in the Variables panel or in your variables dictionary:

JSON
{
  "input": {
    "contentDeploymentType": "ALL_UPDATES",
    "contentSet": {
      "id": "123"
    },
    "description": "example Patch deployment for Linux",
    "downloadImmediately": true,
    "name": "example_deployment_linux",
    "overrideBlocklists": false,
    "patches": null,
    "patchLists": [
      {
        "id": "234",
        "version": 1
      }
    ],
    "platform": "LINUX",
    "restart": false,
    "schedule": {
      "distributeOver": {
        "seconds": 600
      },
      "endTime": "2025-02-01",
      "eussAvailableBeforeStart": false,
      "eussHideFromActivity": false,
      "overrideMaintenanceWindows": false,
      "startTime": "2025-01-01",
      "timeZone": "EST",
      "type": "SINGLE"
    },
    "targets": {
      "computerGroups": [
        {
          "id": "123"
        }
      ]
    },
    "type": "INSTALL"
  }
}

Example response:

JSON
{
  "data": {
    "patchCreateDeployment": {
      "deployment": {
        "id": "123",
        "author": {
          "id": "1",
          "displayName": null,
          "username": "Administrator"
        },
        "contentDeploymentType": "ALL_UPDATES",
        "contentSet": {
          "id": "123"
        },
        "createdTime": "2023-10-18T18:48:43.515Z",
        "description": "example Patch deployment for Linux",
        "downloadImmediately": true,
        "name": "example_deployment_linux",
        "notifications": null,
        "overrideBlocklists": false,
        "patches": [],
        "patchLists": [
          {
            "id": "234",
            "version": 1
          }
        ],
        "platform": "LINUX",
        "restart": false,
        "schedule": {
          "distributeOver": {
            "nanoseconds": 0,
            "seconds": 600
          },
          "endTime": "2025-02-01T00:00:00.000Z",
          "eussAvailableBeforeStart": false,
          "eussHideFromActivity": false,
          "overrideMaintenanceWindows": false,
          "startTime": "2025-01-01T00:00:00.000Z",
          "timeZone": "EST",
          "type": "SINGLE"
        },
        "status": "INACTIVE",
        "stoppedTime": null,
        "targets": {
          "computerGroups": [
            {
              "id": "123"
            }
          ]
        },
        "type": "INSTALL",
        "updatedTime": "2023-10-18T18:48:43.515Z"
      },
      "error": null
    }
  }
}

Create a Patch install deployment for Windows

mutation.patchCreateDeployment

Create a Windows patch deployment

The patchCreateDeployment mutation requires Patch 3.16.191 or later and the Patch Deployment Write and Patch Deployment Execute permissions.

Note: The patchCreateDeployment mutation does not support uploading images to pre-install and post-install user notifications.

The following mutation creates a new deployment for installing Windows patches on targeted endpoints.

Note: Set mutation.patchCreateDeployment (input.type) equal to INSTALL for a Windows patch install deployment, or UNINSTALL for a Windows patch uninstall deployment.
JSON
mutation exampleCreateWindowsPatchDeployment($input: PatchCreateDeploymentInput!) {
  patchCreateDeployment(input: $input) {
    deployment {
      id
      author {
        id
        displayName
        username
      }
      contentDeploymentType
      contentSet {
        id
      }
      createdTime
      description
      downloadImmediately
      name
      notifications {
        postDeployment {
          body
          countdownToDeadline {
            nanoseconds
            seconds
          }
          notificationPeriodDuration {
            nanoseconds
            seconds
          }
          postponeOptions {
            durationOne {
              nanoseconds
              seconds
            }
            durationTwo {
              nanoseconds
              seconds
            }
            durationThree {
              nanoseconds
              seconds
            }
          }
          title
          translations {
            body
            languageCode
            title
          }
        }
      }
      overrideBlocklists
      patches {
        id
      }
      patchLists {
        id
        version
      }
      platform
      restart
      schedule {
        distributeOver {
          nanoseconds
          seconds
        }
        endTime
        eussAvailableBeforeStart
        eussHideFromActivity
        overrideMaintenanceWindows
        startTime
        timeZone
        type
      }
      status
      stoppedTime
      targets {
        computerGroups {
          id
        }
      }
      type
      updatedTime
    }
    error {
      message
      retryable
      timedOut
    }
  }
}

Include the input variables in the Variables panel or in your variables dictionary:

JSON
{
  "input": {
    "contentDeploymentType": "MANUAL_SELECTION",
    "contentSet": {
      "id": "123"
    },
    "description": "example Patch deployment for Windows",
    "downloadImmediately": true,
    "name": "example_deployment_windows",
    "notifications": {
      "postDeployment": {
        "body": "example text display",
        "countdownToDeadline": {
          "seconds": 15
        },
        "notificationPeriodDuration": {
          "seconds": 1440
        },
        "postponeOptions": {
          "durationOne": {
            "seconds": 60
          },
          "durationTwo": {
            "seconds": 120
          },
          "durationThree": {
            "seconds": 240
          }
        },
        "title": "example title",
        "translations": [
          {
            "body": "ejemplo",
            "languageCode": "es",
            "title": "texto"
          }
        ]
      }
    },
    "overrideBlocklists": false,
    "patches": null,
    "patchLists": [
      {
        "id": "234",
        "version": 1
      }
    ],
    "platform": "WINDOWS",
    "restart": true,
    "schedule": {
      "distributeOver": {
        "seconds": 600
      },
      "endTime": null,
      "eussAvailableBeforeStart": false,
      "eussHideFromActivity": false,
      "overrideMaintenanceWindows": false,
      "startTime": "2025-01-01",
      "timeZone": "EST",
      "type": "ONGOING"
    },
    "targets": {
      "computerGroups": [
        {
          "id": "345"
        }
      ]
    },
    "type": "INSTALL"
  }
}

Example response:

JSON
{
  "data": {
    "patchCreateDeployment": {
      "deployment": {
        "id": "123",
        "author": {
          "id": "1",
          "displayName": null,
          "username": "admin"
        },
        "contentDeploymentType": "MANUAL_SELECTION",
        "contentSet": {
          "id": "123"
        },
        "createdTime": "2023-10-24T17:59:00.274Z",
        "description": "example Patch deployment for Windows",
        "downloadImmediately": true,
        "name": "example_deployment_windows",
        "notifications": {
          "postDeployment": {
            "body": "example text display",
            "countdownToDeadline": {
              "nanoseconds": 0,
              "seconds": 0
            },
            "notificationPeriodDuration": {
              "nanoseconds": 0,
              "seconds": 1440
            },
            "postponeOptions": {
              "durationOne": {
                "nanoseconds": 0,
                "seconds": 60
              },
              "durationTwo": {
                "nanoseconds": 0,
                "seconds": 120
              },
              "durationThree": {
                "nanoseconds": 0,
                "seconds": 240
              }
            },
            "title": "example title",
            "translations": [
              {
                "body": "ejemplo",
                "languageCode": "es",
                "title": "texto"
              }
            ]
          }
        },
        "overrideBlocklists": false,
        "patches": [],
        "patchLists": [
          {
            "id": "234",
            "version": 1
          }
        ],
        "platform": "WINDOWS",
        "restart": true,
        "schedule": {
          "distributeOver": {
            "nanoseconds": 0,
            "seconds": 600
          },
          "endTime": null,
          "eussAvailableBeforeStart": false,
          "eussHideFromActivity": false,
          "overrideMaintenanceWindows": false,
          "startTime": "2025-01-01T00:00:00.000Z",
          "timeZone": "EST",
          "type": "ONGOING"
        },
        "status": "INACTIVE",
        "stoppedTime": null,
        "targets": {
          "computerGroups": [
            {
              "id": "345"
            }
          ]
        },
        "type": "INSTALL",
        "updatedTime": "2023-10-24T17:59:00.274Z"
      },
      "error": null
    }
  }
}

Get Patch definitions

query.patchDefinitions

Get multiple patch definitions

The patchDefinition query requires Patch 3.17.175 or later and the Patch Show permission.

The following query retrieves the first patch definition that matches the specified CVE ID.

Note: The filter supports one, and only one, CVE ID to filter the returned patch definitions.
JSON
query exampleGetPatchDefinitions($first: Int, $filter: PatchDefinitionFieldFilter, $sort:PatchDefinitionFieldSort) {
  patchDefinitions(first: $first, filter: $filter, sort: $sort) { 
    edges {
      node {
        id 
        createdDate
        cveIds
        isSuperseded
        platform
        releaseDate
        severity
        sizeInBytes
        title
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    },
    totalRecords
  }
}

Include the pagination and filter variables in the Variables panel or in your variables dictionary:

JSON
{
  "first": 1,
  "filter": {"cveIds": ["CVE-2014-123456"]},
  "sort": {"field": "releaseDate", "order": "desc"}
}

Example response:

JSON
{
  "data": {
    "patchDefinitions": {
      "edges": [
        {
          "node": {
            "id": "1234567890abcdef1234567890abcdef",
            "createdDate": "2021-04-20",
            "cveIds": [
              "CVE-2014-123456"
            ],
            "isSuperseded": false,
            "platform": "LINUX",
            "releaseDate": "2020-01-01",
            "severity": "Important",
            "sizeInBytes": 12345678,
            "title": "example patch definition"
          }
        }
      ],
      "pageInfo": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "eyJpZCI6ImE4OWE0ZGFkZWY2YWU0YTAzZDBjYzY5NGFhZjg4MzMzIiwiY3JlYXRlZERhdGUiOiIyMDIxLTA0LTIwVDA2OjAxOjQ2Ljg1MloiLCJyZWxlYXNlRGF0ZSI6IjIwMTItMDYtMThUMDA6MDA6MDAuMDAwWiJ9",
        "endCursor": "eyJpZCI6ImE4OWE0ZGFkZWY2YWU0YTAzZDBjYzY5NGFhZjg4MzMzIiwiY3JlYXRlZERhdGUiOiIyMDIxLTA0LTIwVDA2OjAxOjQ2Ljg1MloiLCJyZWxlYXNlRGF0ZSI6IjIwMTItMDYtMThUMDA6MDA6MDAuMDAwWiJ9"
      },
      "totalRecords": 1
    }
  }
}

Get a Patch deployment by ID

query.patchDeployment

Get a patch deployment by ID

The patchDeployment query requires Patch 3.16.191 or later and the Patch Deployment Read permission.

The following query retrieves the Patch deployment that matches the specified ID.

JSON
query examplgeGetPatchDeployment($id: ID!) {
  patchDeployment(ref: {id: $id}) {
    id
    author {
      id
      displayName
      username
    }
    contentDeploymentType
    contentSet {
      id
    }
    createdTime
    description
    downloadImmediately
    name
    notifications {
      postDeployment {
        body
        countdownToDeadline {
          nanoseconds
          seconds
        }
        notificationPeriodDuration {
          nanoseconds
          seconds
        }
        postponeOptions {
          durationOne {
            nanoseconds
            seconds
          }
          durationTwo {
            nanoseconds
            seconds
          }
          durationThree {
            nanoseconds
            seconds
          }
        }
        title
        translations {
          body
          languageCode
          title
        }
      }
    }
    overrideBlocklists
    patches {
      id
    }
    patchLists {
      id
      version
    }
    platform
    restart
    schedule {
      distributeOver {
        nanoseconds
        seconds
      }
      endTime
      eussAvailableBeforeStart
      eussHideFromActivity
      overrideMaintenanceWindows
      startTime
      timeZone
      type
    }
    status
    stoppedTime
    targets {
      computerGroups {
        id
      }
    }
    type
    updatedTime
  }
}

Include the ID variable in the Variables panel or in your variables dictionary:

JSON
{
  "id": "123"
}

Example response:

JSON
{
  "data": {
    "patchDeployment": {
      "id": "123",
      "author": {
        "id": "1",
        "displayName": null,
        "username": "Administrator"
      },
      "contentDeploymentType": "ALL_UPDATES",
      "contentSet": {
        "id": "123"
      },
      "createdTime": "2023-10-18T18:48:43.515Z",
      "description": "example Patch deployment for Linux",
      "downloadImmediately": true,
      "name": "example_deployment_linux",
      "notifications": null,
      "overrideBlocklists": false,
      "patches": [],
      "patchLists": [
        {
          "id": "234",
          "version": 1
        }
      ],
      "platform": "LINUX",
      "restart": false,
      "schedule": {
        "distributeOver": {
          "nanoseconds": 0,
          "seconds": 600
        },
        "endTime": "2025-02-01T00:00:00.000Z",
        "eussAvailableBeforeStart": false,
        "eussHideFromActivity": false,
        "overrideMaintenanceWindows": false,
        "startTime": "2025-01-01T00:00:00.000Z",
        "timeZone": "EST",
        "type": "SINGLE"
      },
      "status": "INACTIVE",
      "stoppedTime": null,
      "targets": {
        "computerGroups": [
          {
            "id": "1"
          }
        ]
      },
      "type": "INSTALL",
      "updatedTime": "2023-10-18T18:48:44.693Z"
    }
  }
}

Stop a Patch deployment by ID

mutation.patchStopDeployment

Stop a patch deployment by ID

The patchStopDeployment mutation requires Patch 3.16.191 or later and the Patch Deployment write and Patch Deployment execute permissions.

The following mutation updates a deployment that matches the ID 123.

JSON
mutation exampleStopPatchDeployment($id: ID!) {
  patchStopDeployment(ref: {id: $id}) {
    deployment {
      id
      author {
        id
        displayName
        username
      }
      contentDeploymentType
      contentSet {
        id
      }
      createdTime
      description
      downloadImmediately
      name
      notifications {
        postDeployment {
          body
          countdownToDeadline {
            nanoseconds
            seconds
          }
          notificationPeriodDuration {
            nanoseconds
            seconds
          }
          postponeOptions {
            durationOne {
              nanoseconds
              seconds
            }
            durationTwo {
              nanoseconds
              seconds
            }
            durationThree {
              nanoseconds
              seconds
            }
          }
          title
          translations {
            body
            languageCode
            title
          }
        }
      }
      overrideBlocklists
      patches {
        id
      }
      patchLists {
        id
        version
      }
      platform
      restart
      schedule {
        distributeOver {
          nanoseconds
          seconds
        }
        endTime
        eussAvailableBeforeStart
        eussHideFromActivity
        overrideMaintenanceWindows
        startTime
        timeZone
        type
      }
      status
      stoppedTime
      targets {
        computerGroups {
          id
        }
      }
      type
      updatedTime
    }
    error {
      message
      retryable
      timedOut
    }
  }
}

Include the ID variable in the Variables panel or in your variables dictionary:

JSON
{
  "id": "123"
}

Example response:

JSON
{
  "data": {
    "patchStopDeployment": {
      "deployment": {
        "id": "123",
        "author": {
          "id": "1",
          "displayName": null,
          "username": "Administrator"
        },
        "contentDeploymentType": "ALL_UPDATES",
        "contentSet": {
          "id": "123"
        },
        "createdTime": "2023-10-18T18:48:43.515Z",
        "description": "example Patch deployment for Linux",
        "downloadImmediately": true,
        "name": "example_deployment_linux",
        "notifications": null,
        "overrideBlocklists": false,
        "patches": null,
        "patchLists": [
          {
            "id": "234",
            "version": 1
          }
        ],
        "platform": "LINUX",
        "restart": false,
        "schedule": {
          "distributeOver": {
            "nanoseconds": 0,
            "seconds": 600
          },
          "endTime": "2025-02-01T00:00:00.000Z",
          "eussAvailableBeforeStart": false,
          "eussHideFromActivity": false,
          "overrideMaintenanceWindows": false,
          "startTime": "2025-01-01T00:00:00.000Z",
          "timeZone": "EST",
          "type": "SINGLE"
        },
        "status": "STOPPED",
        "stoppedTime": "2023-10-18T19:16:28.105Z",
        "targets": {
          "computerGroups": [
            {
              "id": "1"
            }
          ]
        },
        "type": "INSTALL",
        "updatedTime": "2023-10-18T19:16:28.123Z"
      },
      "error": null
    }
  }
}

Upsert (create or update by ID) a Patch patch list

mutation.patchListUpsert

Upsert (create or update by ID) a patch list

The patchListUpsert mutation requires Patch 3.24.83 or later and the Patch Patchlist execute and Patch Patchlist write permissions.

The patchListUpsert mutation either creates a new patch list or updates the existing patch list that matches an ID.

Note: Although you can manually select patches to include in a patch list, it is more efficient to use rules to dynamically populate lists of patches.

The following mutation creates a new Linux patch list. The list defines two rules:

  • include all patches with "example" in the title

  • include all critical severity patches released in the past seven days

JSON
mutation examplePatchListCreate($input: PatchListUpsertInput!) {
  patchListUpsert(input: $input) {
    patchList {
      id 
      name 
      author {
        id 
        displayName 
        username
      }
      contentSet {
        id 
        description 
        name
      }
      createdTime 
      includeSupersededPatches 
      isTaniumManaged
      patchDefinitionIDs
      platform 
      rules {
        name 
        conditions {
          comparisonOperator 
          fieldName 
          fieldValue
        }
      }
      updatedTime 
      version 
    } 
    error {
      message 
      retryable
      timedOut
    }  
  }
}

Include the input variables in the Variables panel or in your variables dictionary:

JSON
{
  "input": {
    "name": "example_patch_list",
    "platform": "LINUX",
    "contentSet": {
      "id": "234"
    },
    "patchDefinitionIDs": [],
    "includeSupersededPatches": false,
    "rules": [
      {
        "name": "example_rule_1",
        "conditions": [
          {
            "fieldName": "TITLE",
            "comparisonOperator": "CONTAINS",            
            "fieldValue": {
              "value": "example"
            }
          }
        ]
      },
      {
        "name": "example_rule_2",
        "conditions": [
          {
            "fieldName": "RELEASE_DATE",
            "comparisonOperator": "ON_OR_BEFORE_RELATIVE_DAYS",
            "fieldValue": {
              "releaseDateDaysAgo": 7
            }
          },
          {
            "fieldName": "SEVERITY",
            "comparisonOperator": "EQUALS",
            "fieldValue": {
              "severity": "CRITICAL"
            }         
          }
        ]
      }
    ]
  }
}

Example response:

JSON
{
  "data": {
    "patchListUpsert": {
      "patchList": {
        "id": "123",
        "name": "example_patch_list",
        "author": {
          "id": "1",
          "displayName": null,
          "username": "admin"
        },
        "contentSet": {
          "id": "53",
          "description": "Default container for objects.",
          "name": "Patch Content Set"
        },
        "createdTime": "2025-02-03T14:24:43.327Z",
        "includeSupersededPatches": false,
        "isTaniumManaged": false,
        "patchDefinitionIDs": [],
        "platform": "LINUX",
        "rules": [
          {
            "name": "example_rule_1",
            "conditions": [
              {
                "comparisonOperator": "CONTAINS",
                "fieldName": "TITLE",
                "fieldValue": "example"
              }
            ]
          },
          {
            "name": "example_rule_2",
            "conditions": [
              {
                "comparisonOperator": "ON_OR_BEFORE_RELATIVE_DAYS",
                "fieldName": "RELEASE_DATE",
                "fieldValue": "7"
              },
              {
                "comparisonOperator": "EQUALS",
                "fieldName": "SEVERITY",
                "fieldValue": "CRITICAL"
              }
            ]
          }
        ],
        "updatedTime": "2025-02-03T14:24:43.370Z",
        "version": 1
      },
      "error": null
    }
  }
}

The following mutation updates the patch list with the ID 123.

JSON
mutation examplePatchListUpdate($input: PatchListUpsertInput!) {
  patchListUpsert(input: $input) {
    patchList {
      id 
      name 
      author {
        id 
        displayName 
        username
      }
      contentSet {
        id 
        description 
        name
      }
      createdTime 
      includeSupersededPatches 
      isTaniumManaged
      patchDefinitionIDs
      platform 
      rules {
        name 
        conditions {
          comparisonOperator 
          fieldName 
          fieldValue
        }
      }
      updatedTime 
      version 
    } 
    error {
      message 
      retryable
      timedOut
    }  
  }
}

Include the input variables in the Variables panel or in your variables dictionary:

JSON
{
  "input": {
    "id": "123",  
    "name": "example_patch_list",
    "platform": "LINUX",
    "contentSet": {
      "id": "234"
    },
    "patchDefinitionIDs": [],
    "includeSupersededPatches": false,
    "rules": [
      {
        "name": "example_rule_1",
        "conditions": [
          {
            "fieldName": "TITLE",
            "comparisonOperator": "CONTAINS",            
            "fieldValue": {
              "value": "example"
            }
          }
        ]
      }
    ]
  }
}

Example response:

JSON
{
  "data": {
    "patchListUpsert": {
      "patchList": {
        "id": "123",
        "name": "example_patch_list",
        "author": {
          "id": "1",
          "displayName": null,
          "username": "admin"
        },
        "contentSet": {
          "id": "53",
          "description": "Default container for objects.",
          "name": "Patch Content Set"
        },
        "createdTime": "2025-02-03T14:24:43.327Z",
        "includeSupersededPatches": false,
        "isTaniumManaged": false,
        "patchDefinitionIDs": [],
        "platform": "LINUX",
        "rules": [
          {
            "name": "example_rule_1",
            "conditions": [
              {
                "comparisonOperator": "CONTAINS",
                "fieldName": "TITLE",
                "fieldValue": "example"
              }
            ]
          }
        ],
        "updatedTime": "2025-02-03T14:24:43.370Z",
        "version": 1
      },
      "error": null
    }
  }
}