Skip to content

Sorting Query Examples

Sort by publication date in ascending order

This query retrieves news articles sorted by publication date from oldest to newest.

python
params = {
    "sort.by": "published_at",
    "sort.order": "asc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY"

Sort by sentiment score in descending order

This query retrieves news articles sorted by sentiment score from highest (most positive) to lowest.

python
params = {
    "sort.by": "sentiment.overall.score",
    "sort.order": "desc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?sort.by=sentiment.overall.score&sort.order=desc&api_key=YOUR_API_KEY"

Multi-dimensional content ranking

This query ranks technology articles from high-quality sources by sentiment score.

python
params = {
    "category.id": "4",
    "source.rank.opr.min": "0.7",
    "sort.by": "sentiment.overall.score",
    "sort.order": "desc",
    "published_at.start": "2023-01-01",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?category.id=4&source.rank.opr.min=0.7&sort.by=sentiment.overall.score&sort.order=desc&published_at.start=2023-01-01&api_key=YOUR_API_KEY"

Media-rich content prioritization

This query prioritizes articles with the most images in technology and sports categories.

python
params = {
    "media.images.count": "2",
    "media.videos.count": "1",
    "sort.by": "media.images.count",
    "sort.order": "desc",
    "category.id": "4,7",
    "published_at.start": "2023-01-01",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?media.images.count=2&media.videos.count=1&sort.by=media.images.count&sort.order=desc&category.id=4,7&published_at.start=2023-01-01&api_key=YOUR_API_KEY"

Chronological event analysis

This query analyzes news about a major event in chronological order.

python
params = {
    "title": "election",
    "category.id": "3",
    "published_at.start": "2020-11-03",
    "published_at.end": "2020-11-10",
    "sort.by": "published_at",
    "sort.order": "asc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=election&category.id=3&published_at.start=2020-11-03&published_at.end=2020-11-10&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY"

Source quality ranking

This query ranks articles about AI by source quality.

python
params = {
    "title": "artificial intelligence",
    "category.id": "4",
    "published_at.start": "2023-01-01",
    "sort.by": "source.rank.opr",
    "sort.order": "desc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=artificial%20intelligence&category.id=4&published_at.start=2023-01-01&sort.by=source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY"

Sentiment evolution tracking

This query tracks how sentiment about a topic has evolved over time.

python
params = {
    "topic.id": "climate_change",
    "published_at.start": "2020-01-01",
    "published_at.end": "2023-12-31",
    "sort.by": "published_at",
    "sort.order": "asc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?topic.id=climate_change&published_at.start=2020-01-01&published_at.end=2023-12-31&sort.by=published_at&sort.order=asc&api_key=YOUR_API_KEY"

Multi-faceted brand perception sorting

This query sorts coverage of multiple competing brands across different parameters simultaneously to create a comprehensive comparison.

python
params = {
    "brand.name": "Tesla,Rivian,Lucid,Nio",
    "category.id": "2,4",
    "published_at.start": "2023-01-01",
    "sort.by": "brand.name,sentiment.overall.score,source.rank.opr",
    "sort.order": "desc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?brand.name=Tesla,Rivian,Lucid,Nio&category.id=2,4&published_at.start=2023-01-01&sort.by=brand.name,sentiment.overall.score,source.rank.opr&sort.order=desc&api_key=YOUR_API_KEY"

Hierarchical regional news prioritization

This query implements complex sorting to organize news by geographical regions, then by topic importance, and finally by publication recency.

python
params = {
    "source.country.code": "us,gb,de,fr,jp",
    "category.id": "3,4",
    "title": "climate,energy,sustainability",
    "published_at.start": "2023-01-01",
    "sort.by": "source.country.code,category.id,published_at",
    "sort.order": "asc,desc,desc",
    "api_key": "YOUR_API_KEY"
}
shell
curl -X GET "https://api.apitube.io/v1/news/everything?source.country.code=us,gb,de,fr,jp&category.id=3,4&title=climate,energy,sustainability&published_at.start=2023-01-01&sort.by=source.country.code,category.id,published_at&sort.order=asc,desc,desc&api_key=YOUR_API_KEY"