Export articles to Excel format
Export news articles to XLSX format for data analysis
Invoerparameter
| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| export | Export format (xlsx, csv, tsv, xml, json). | string | Yes | |
| category.id | Category filter (optional). | string | No | |
| published_at.start | Start date filter (optional). | string | No | |
| published_at.end | End date filter (optional). | string | No | |
| api_key | Your API key. | string | Yes |
Workflow examples
Request to export articles to Excel:
curl -X GET "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&published_at.start=2023-01-01&published_at.end=2023-12-31&export=xlsx&api_key=YOUR_API_KEY" -o financial_news_2023.xlsx
Request to export to CSV:
curl -X GET "https://api.apitube.io/v1/news/everything?organization.name=Amazon,Microsoft,Google&published_at.start=2023-01-01&published_at.end=2023-12-31&sort.by=sentiment.overall.score&sort.order=desc&export=csv&api_key=YOUR_API_KEY" -o tech_sentiment_2023.csv
Request to export to XML:
curl -X GET "https://api.apitube.io/v1/news/everything?title=bitcoin&export=xml&api_key=YOUR_API_KEY" -o bitcoin_news.xml
Recept voor cURL
curl --location --globoff --request POST 'https://api.apitube.io/v1/news/everything?category.id=medtop%3A04000000&published_at.start=2023-01-01&published_at.end=2023-12-31&export=xlsx&api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json'
Recept voor Python
import requests
url = "https://api.apitube.io/v1/news/everything"
querystring = {
"category.id": "medtop:04000000",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"export": "xlsx",
"api_key": "YOUR_API_KEY"
}
response = requests.request("GET", url, params=querystring)
print(response.text)
Recept voor Javascript
import axios from "axios"
const options = {
method: 'GET',
url: 'https://api.apitube.io/v1/news/everything',
params: {
"category.id": "medtop:04000000",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"export": "xlsx",
"api_key": "YOUR_API_KEY"
}};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Recept voor PHP
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('GET', 'https://api.apitube.io/v1/news/everything', [
'query' => [
'category.id' => 'medtop:04000000',
'published_at.start' => '2023-01-01',
'published_at.end' => '2023-12-31',
'export' => 'xlsx',
'api_key' => 'YOUR_API_KEY',
],
]);
echo $response->getBody();
Recept voor 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?category.id=medtop%3A04000000&published_at.start=2023-01-01&published_at.end=2023-12-31&export=xlsx&api_key=YOUR_API_KEY")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();