Advanced faceting with multiple filters

Combine faceting with complex filters for comprehensive analytics dashboards

Indataparameter

ParameterDescriptionTypeDefaultRequired
titleSearch query.stringYes
facetEnable faceting.booleantrueYes
facet.fieldMultiple fields to facet on (comma-separated).stringYes
facet.limitMaximum facet values per field.integer10Yes
published_at.startStart date filter.stringYes
source.rank.opr.minMinimum source quality.stringYes
api_keyYour API key.stringYes
per_pageMaximum number of articles to retrieve.integer20No

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"

Recept för 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'

Recept för 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)

Recept för 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);
});

Recept för 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();

Recept för 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();
		
  • CNN
  • Techcrunch
  • Vox
  • Apple
  • Microsoft
  • IBM
  • Bloomberg
  • Spotify