Advanced faceting with multiple filters
Combine faceting with complex filters for comprehensive analytics dashboards
Input parameters
| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| title | Search query. | string | Yes | |
| facet | Enable faceting. | boolean | true | Yes |
| facet.field | Multiple fields to facet on (comma-separated). | string | Yes | |
| facet.limit | Maximum facet values per field. | integer | 10 | Yes |
| published_at.start | Start date filter. | string | Yes | |
| source.rank.opr.min | Minimum source quality. | string | Yes | |
| api_key | Your API key. | string | Yes | |
| per_page | Maximum number of articles to retrieve. | integer | 20 | No |
Workflow examples
Request for advanced faceting with filters:
curl -X GET "https://api.apitube.io/v1/news/everything?title=AI&facet=true&facet.field=source.id,category.id,language.id,sentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&source.rank.opr.min=0.6&api_key=YOUR_API_KEY"
Request for language distribution analysis:
curl -X GET "https://api.apitube.io/v1/news/everything?organization.name=Tesla&facet=true&facet.field=language.id,source.country.id&facet.limit=15&api_key=YOUR_API_KEY"
Request for media bias distribution:
curl -X GET "https://api.apitube.io/v1/news/everything?topic.id=climate_change&facet=true&facet.field=source.bias,source.country.id&api_key=YOUR_API_KEY"
Request for temporal analysis - articles by hour:
curl -X GET "https://api.apitube.io/v1/news/everything?facet=true&facet.field=published.hour&published_at.start=2024-01-01&api_key=YOUR_API_KEY"
Recipe for cURL
curl --location --globoff --request POST 'https://api.apitube.io/v1/news/everything?title=AI&facet=1&facet.field=source.id%2Ccategory.id%2Clanguage.id%2Csentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&source.rank.opr.min=0.6&api_key=YOUR_API_KEY&per_page=20' \
--header 'Content-Type: application/json'
Recipe for Python
import requests
url = "https://api.apitube.io/v1/news/everything"
querystring = {
"title": "AI",
"facet": true,
"facet.field": "source.id,category.id,language.id,sentiment.overall.polarity",
"facet.limit": 10,
"published_at.start": "2024-01-01",
"source.rank.opr.min": 0.6,
"api_key": "YOUR_API_KEY",
"per_page": 20
}
response = requests.request("GET", url, params=querystring)
print(response.text)
Recipe for Javascript
import axios from "axios"
const options = {
method: 'GET',
url: 'https://api.apitube.io/v1/news/everything',
params: {
"title": "AI",
"facet": true,
"facet.field": "source.id,category.id,language.id,sentiment.overall.polarity",
"facet.limit": 10,
"published_at.start": "2024-01-01",
"source.rank.opr.min": 0.6,
"api_key": "YOUR_API_KEY",
"per_page": 20
}};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Recipe for PHP
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('GET', 'https://api.apitube.io/v1/news/everything', [
'query' => [
'title' => 'AI',
'facet' => 1,
'facet.field' => 'source.id,category.id,language.id,sentiment.overall.polarity',
'facet.limit' => 10,
'published_at.start' => '2024-01-01',
'source.rank.opr.min' => 0.6,
'api_key' => 'YOUR_API_KEY',
'per_page' => 20,
],
]);
echo $response->getBody();
Recipe for Java
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.apitube.io/v1/news/everything?title=AI&facet=1&facet.field=source.id%2Ccategory.id%2Clanguage.id%2Csentiment.overall.polarity&facet.limit=10&published_at.start=2024-01-01&source.rank.opr.min=0.6&api_key=YOUR_API_KEY&per_page=20")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();