Editing Queries
After you have created a query, it can be edited via the API. It accepts both HTTP PATCH
and PUT
requests.
Required Fields
When editing using PATCH
method the query must include at least one of the optional fields in your request.
When using PUT
method it requires the following:
Parameter | Definition | Accepted Values |
---|---|---|
id | Query ID | Integer |
name | Query name | String |
booleanQuery | Boolean query | String |
Optional Fields
PATCH
Method
PATCH
MethodParameter | Definition | Accepted Values |
---|---|---|
name | Name of the query | String |
displayName | Display name of the query in the UI | String |
removeDisplayName | Display name to remove, see note below. | String |
state | Whether the query is active or in draft, see note below. | active or draft |
state
Parameter NoteYou can only set a query's state from
draft
toactive
. You cannot set a query's state fromactive
todraft
.
removeDisplayName
Parameter NoteYou cannot set
displayName
andremoveDisplayName
in the same request.
PUT
Method
PUT
MethodParameter | Definition | Accepted Values |
---|---|---|
displayName | Display name of the query in the UI | String |
description | Query description | String |
languages | Two letter language code, e.g. en , es , de | String or string array |
state | Whether the query is active or in draft, see note below. | active or draft |
state
Parameter NoteYou can only set a query's state from
draft
toactive
. You cannot set a query's state fromactive
todraft
.
Editing Query
The following call will change a query's display name with a project with ID 1998159537 and query with ID 1999933037:
curl -X PATCH \
'https://api.brandwatch.com/projects/1998159537/queries/1999934807' \
-H 'Content-Type: application/json' \
-d '{"displayName": "New display name"}'
Alternatively, PUT
methods are also accepted. The following will set the query's boolean query and name:
curl -X PUT \
'https://api.brandwatch.com/projects/1998159537/queries/999970708' \
-H 'Content-Type: application/json' \
-d '{"id": 999970708, "booleanQuery": "Brandwatch", "name": "New BW query name"}'
Response
{
"id": 1999934807,
"name": "Mentions of Pepsi",
"displayName": "New display name",
"description": null,
"creationDate": "2025-04-08T11:03:58.341+0000",
"lastModificationDate": "2025-05-20T12:08:18.505+0000",
"languages": ["en"],
"type": "monitor",
"highlightTerms": ["pepsi"],
"lastModifiedUsername": "[email protected]",
"createdByUsername": "[email protected]",
"lockedQuery": false,
"lockedByUsername": null,
"lockedTime": null,
"booleanQuery": "pepsi",
"monitorId": 7867716243,
"startDate": "2025-03-01T00:00:00.000+0000",
"percentComplete": 100,
"samplePercentage": 100.0,
"userRequestedSampling": false,
"sampled": false,
"queryLimitUsage": 1,
"locationFilter": null,
"imageFilter": null,
"trackedPageFilter": null,
"contentSources": ["news"],
"audienceLists": null,
"exclusionSnippets": [],
"active": true,
"state": "active",
"projectId": 1,
"sharedWithProjectIds": [1],
"sentimentClassifierVersion": 3,
"trendsEnabled": false
}
Updated 3 days ago