The addToBlocklist() GraphQL mutation may be used to blocklist a query based an exactly matched given value, or based on a pattern given in a regular expression.

For more information on blocking queries, see the Blocking Queries documentation page.

Syntax

Below is the syntax for the addToBlocklist() mutation field:

graphql
addToBlocklist(
      input: AddToBlocklistInput!
   ): [BlockedQuery!]!

Given Datatypes

For the input (i.e., AddToBlocklistInput), there are a few parameters that may be given. Below is a list of them along with their data type and a description of each:

Table: AddToBlocklistInput

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 17, 2024
patternstringyes The pattern to match for selecting data to add to the blocklist.
typeBlockedQueryMatcherTypeyes Whether the pattern should be matched exactly or interpreted as a regex pattern. See BlockedQueryMatcherType.
viewNamestringyes Limits the scope of the pattern to a specific view preventing matching queries from execution in that context only.
clusterWideboolean  Whether to apply the pattern, globally. Requires the ManageCluster permission.

In this table, there is a special datatype called, BlockedQueryMatcherType. It's a simple enumerated list of choices: EXACT, and REGEX.

Returned Datatypes

As indicated by the syntax above, this mutation will return data using the datatype, BlockedQuery. Below is a list of the parameters of that datatype:

Table: BlockedQuery

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 24, 2024
expiresAtdatetime  The date and time in which any matching queries will cease to be blocked.
expiresInMillisecondsinteger  The amount of milliseconds until any matching queries won't be blocked.
idstringyes The unique identifier of the blocked query.
limitedToOrganizationbooleanyes Whether the blocked query should be limited to the organization.
organizationOrganization  The organization associated with the view, if any. See Organization.
patternstringyes The exact or regular expression pattern used to match queries to block.
typeBlockedQueryMatcherTypeyes How the pattern should be matched (e.g., as a regular expression). See BlockedQueryMatcherType.
unblockAllowedbooleanyes Whether the current user is allowed to unblock the query.
viewView  The related view, if any. See View.

As with the AddToBlocklistInput, the BlockedQuery also has a parameter which uses BlockedQueryMatcherType datatype. It's a simple enumerated list of choices: EXACT, and REGEX.