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

ParameterTypeRequired[a]DefaultDescription
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. The datatype is an enumerated list of values: EXACT, or REGEX.
viewNamestringyes Limits the scope of the pattern to a specific view preventing matching queries from execution in that context only.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


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

ParameterTypeRequired[a]DefaultDescription
idstringyes The unique identifier of the blocked query.
expiresAtdatetime  The date and time in which any matching queries will cease to be blocked.
expiresInMillisecondsinteger  The amount of milliseconds from now in which any matching queries will cease to be blocked.
patternstringyes The exact or regular expression pattern used to match queries to be blocked.
typeBlockedQueryMatcherTypeyes Whether the pattern should be matched exactly or interpreted as a regular express: EXACT, or REGEX.
viewView  The related view, if any (see View Table).
organizationOrganization  The organization associated with the view, if any (see Organization Table).

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


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.