Get all queries
curl --request POST \
--url https://api.mentionlab.io/api/queries/list \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"query": "climate change",
"languages": [
"en",
"fr"
],
"countries": [
"BE",
"FR"
],
"types": [],
"hasRecurrenceSetting": false,
"recurrenceSettingIds": [
"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c"
],
"tagIds": [
12,
34
],
"tagGroupIds": [
"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42"
],
"tagNames": [
"politics",
"economy"
],
"sort": [
{
"field": "query",
"direction": "ASC"
}
]
}
'import requests
url = "https://api.mentionlab.io/api/queries/list"
payload = {
"query": "climate change",
"languages": ["en", "fr"],
"countries": ["BE", "FR"],
"types": [],
"hasRecurrenceSetting": False,
"recurrenceSettingIds": ["018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c"],
"tagIds": [12, 34],
"tagGroupIds": ["018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42"],
"tagNames": ["politics", "economy"],
"sort": [
{
"field": "query",
"direction": "ASC"
}
]
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'climate change',
languages: ['en', 'fr'],
countries: ['BE', 'FR'],
types: [],
hasRecurrenceSetting: false,
recurrenceSettingIds: ['018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c'],
tagIds: [12, 34],
tagGroupIds: ['018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42'],
tagNames: ['politics', 'economy'],
sort: [{field: 'query', direction: 'ASC'}]
})
};
fetch('https://api.mentionlab.io/api/queries/list', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mentionlab.io/api/queries/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'climate change',
'languages' => [
'en',
'fr'
],
'countries' => [
'BE',
'FR'
],
'types' => [
],
'hasRecurrenceSetting' => false,
'recurrenceSettingIds' => [
'018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c'
],
'tagIds' => [
12,
34
],
'tagGroupIds' => [
'018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42'
],
'tagNames' => [
'politics',
'economy'
],
'sort' => [
[
'field' => 'query',
'direction' => 'ASC'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mentionlab.io/api/queries/list"
payload := strings.NewReader("{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mentionlab.io/api/queries/list")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/queries/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"page": {
"totalRecords": 123,
"limit": 123,
"currentPage": 123,
"totalPages": 123,
"nextPage": 123,
"prevPage": 123
},
"results": [
{
"id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"project": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"tags": [
1,
2,
3
],
"query": "mentionlab",
"language": "en",
"country": "US",
"updatedAt": "2023-08-22T10:00:00.000Z",
"type": "comparative",
"recurrenceSetting": {
"id": "018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c",
"name": "Daily core queries"
}
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Queries
Get all queries
Returns a paginated list of the project’s queries, applying the filters and sorting from the request body; each result includes its tag IDs.
POST
/
api
/
queries
/
list
Get all queries
curl --request POST \
--url https://api.mentionlab.io/api/queries/list \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"query": "climate change",
"languages": [
"en",
"fr"
],
"countries": [
"BE",
"FR"
],
"types": [],
"hasRecurrenceSetting": false,
"recurrenceSettingIds": [
"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c"
],
"tagIds": [
12,
34
],
"tagGroupIds": [
"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42"
],
"tagNames": [
"politics",
"economy"
],
"sort": [
{
"field": "query",
"direction": "ASC"
}
]
}
'import requests
url = "https://api.mentionlab.io/api/queries/list"
payload = {
"query": "climate change",
"languages": ["en", "fr"],
"countries": ["BE", "FR"],
"types": [],
"hasRecurrenceSetting": False,
"recurrenceSettingIds": ["018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c"],
"tagIds": [12, 34],
"tagGroupIds": ["018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42"],
"tagNames": ["politics", "economy"],
"sort": [
{
"field": "query",
"direction": "ASC"
}
]
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'climate change',
languages: ['en', 'fr'],
countries: ['BE', 'FR'],
types: [],
hasRecurrenceSetting: false,
recurrenceSettingIds: ['018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c'],
tagIds: [12, 34],
tagGroupIds: ['018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42'],
tagNames: ['politics', 'economy'],
sort: [{field: 'query', direction: 'ASC'}]
})
};
fetch('https://api.mentionlab.io/api/queries/list', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mentionlab.io/api/queries/list",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'climate change',
'languages' => [
'en',
'fr'
],
'countries' => [
'BE',
'FR'
],
'types' => [
],
'hasRecurrenceSetting' => false,
'recurrenceSettingIds' => [
'018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c'
],
'tagIds' => [
12,
34
],
'tagGroupIds' => [
'018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42'
],
'tagNames' => [
'politics',
'economy'
],
'sort' => [
[
'field' => 'query',
'direction' => 'ASC'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mentionlab.io/api/queries/list"
payload := strings.NewReader("{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mentionlab.io/api/queries/list")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/queries/list")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"climate change\",\n \"languages\": [\n \"en\",\n \"fr\"\n ],\n \"countries\": [\n \"BE\",\n \"FR\"\n ],\n \"types\": [],\n \"hasRecurrenceSetting\": false,\n \"recurrenceSettingIds\": [\n \"018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c\"\n ],\n \"tagIds\": [\n 12,\n 34\n ],\n \"tagGroupIds\": [\n \"018f3a2b-7c4d-7e91-b3f5-2a6c8d0e1f42\"\n ],\n \"tagNames\": [\n \"politics\",\n \"economy\"\n ],\n \"sort\": [\n {\n \"field\": \"query\",\n \"direction\": \"ASC\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"page": {
"totalRecords": 123,
"limit": 123,
"currentPage": 123,
"totalPages": 123,
"nextPage": 123,
"prevPage": 123
},
"results": [
{
"id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"project": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"tags": [
1,
2,
3
],
"query": "mentionlab",
"language": "en",
"country": "US",
"updatedAt": "2023-08-22T10:00:00.000Z",
"type": "comparative",
"recurrenceSetting": {
"id": "018f3a2b-7c4d-7e1a-9b2c-3d4e5f6a7b8c",
"name": "Daily core queries"
}
}
]
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Query Parameters
Body
application/json
Filter queries by language. Accepts one or more supported language codes; only queries matching any of the provided codes are returned.
Available options:
en, es, fr, pt, de, it, tr, nl, pl, sq, ar, hy, az, ba, eu, be, bn, bho, bs, bg, yue, ca, zh-cn, hr, cs, da, et, fo, fi, gl, ka, el, gu, hi, hu, id, ga, ja, jv, kn, ks, kk, kok, ko, ky, lv, lt, ru, mk, mai, ms, mt, cmn, mr, mwr, nan, ro-MD, mn, cnr, ne, no, or, ps, fa, pa, raj, ro, sa, sat, sr, sd, si, sk, sl, sv, uk, ur, uz, vi, cy, wuu, th Example:
["en", "fr"]
Filter queries by country. Accepts one or more supported country codes; only queries matching any of the provided codes are returned.
Available options:
AD, AE, AF, AG, AL, AM, AO, AR, AT, AU, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BN, BO, BR, BS, BT, BW, BZ, CA, CD, CF, CG, CH, CI, CL, CN, CM, CO, CR, CV, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, ER, ES, ET, FI, FJ, FM, FR, GA, GB, GD, GE, GH, GM, GN, GQ, GR, GT, GW, GY, HK, HN, HR, HT, HU, ID, IE, IL, IN, IQ, IS, IT, JM, JO, JP, KE, KG, KH, KI, KM, KR, KW, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MG, MH, MK, ML, MM, MN, MR, MT, MU, MV, MW, MX, MY, MZ, NA, NE, NG, NI, NL, NO, NP, NR, NZ, OM, PA, PE, PG, PH, PK, PL, PS, PT, PW, PY, QA, RO, RS, RW, SA, SB, SC, SD, SE, SG, SI, SK, SL, SM, SN, SO, SR, SS, SV, SZ, TD, TG, TH, TJ, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, US, UY, UZ, VA, VN, VU, WS, YE, ZA, ZM, ZW Example:
["BE", "FR"]
Filter queries by type. Accepts one or more types; only queries matching any of the provided types are returned. Untyped queries are excluded when this filter is set.
The type of question the query asks: "comparative" (compares options), "informative" (seeks facts or how-to information) or "perception" (probes opinions about a brand).
Available options:
comparative, informative, perception