การดึงชุดข้อมูลขนาดใหญ่พร้อมการเลือกฟิลด์
ดึงชุดข้อมูลขนาดใหญ่โดยใช้การเลือกฟิลด์ การแบ่งหน้า และการกรอง
พารามิเตอร์อินพุต
| พารามิเตอร์ | คำอธิบาย | ประเภท | ค่าเริ่มต้น | จำเป็น |
|---|---|---|---|---|
| category.id | ตัวกรองหมวดหมู่ | string | ใช่ | |
| published_at.start | ตัวกรองวันที่เริ่มต้น | string | ใช่ | |
| published_at.end | ตัวกรองวันที่สิ้นสุด | string | ใช่ | |
| per_page | บทความต่อหน้า (100 สำหรับชุดข้อมูลขนาดใหญ่) | integer | 100 | ใช่ |
| page | หมายเลขหน้าสำหรับการแบ่งหน้า | integer | 1 | ใช่ |
| sort.by | จัดเรียงตามวันที่เผยแพร่ | string | ใช่ | |
| sort.order | ลำดับจากมากไปน้อย | string | ใช่ | |
| fl | การเลือกฟิลด์เพื่อการปรับปรุงประสิทธิภาพ | string | ใช่ | |
| api_key | คีย์ API ของคุณ | string | ใช่ |
ตัวอย่างขั้นตอนการทำงาน
การดึงข้อมูลชุดข้อมูลขนาดใหญ่ที่มีประสิทธิภาพ:
curl -X GET "https://api.apitube.io/v1/news/everything?category.id=medtop:13000000&published_at.start=2023-01-01&published_at.end=2023-12-31&per_page=100&page=1&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY"
การเพิ่มประสิทธิภาพการทำงานสำหรับชุดข้อมูลขนาดใหญ่:
curl -X GET "https://api.apitube.io/v1/news/everything?fl=id,title,source.domain&per_page=100&published_at.start=2024-01-01&api_key=YOUR_API_KEY"
การค้นหาแบบแบ่งหน้าด้วยหลายเกณฑ์:
curl -X GET "https://api.apitube.io/v1/news/everything?organization.name=Amazon&sentiment.overall.polarity=positive&per_page=25&page=3&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY"
ตัวอย่างที่เกี่ยวข้อง
- เลือกฟิลด์เฉพาะ
- แดชบอร์ดวิเคราะห์
- เรียงลำดับตามคะแนนการมีส่วนร่วม
- รับข่าวสารที่จัดเรียงตามวันที่
- ส่งออกบทความไปยัง Excel
สูตรสำหรับ cURL
curl --location --globoff --request POST 'https://api.apitube.io/v1/news/everything?category.id=medtop%3A13000000&published_at.start=2023-01-01&published_at.end=2023-12-31&per_page=100&page=1&sort.by=published_at&sort.order=desc&fl=id%2Ctitle%2Cpublished_at%2Csource.domain&api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json'
สูตรสำหรับ Python
import requests
url = "https://api.apitube.io/v1/news/everything"
querystring = {
"category.id": "medtop:13000000",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"per_page": 100,
"page": 1,
"sort.by": "published_at",
"sort.order": "desc",
"fl": "id,title,published_at,source.domain",
"api_key": "YOUR_API_KEY"
}
response = requests.request("GET", url, params=querystring)
print(response.text)
สูตรสำหรับ Javascript
import axios from "axios"
const options = {
method: 'GET',
url: 'https://api.apitube.io/v1/news/everything',
params: {
"category.id": "medtop:13000000",
"published_at.start": "2023-01-01",
"published_at.end": "2023-12-31",
"per_page": 100,
"page": 1,
"sort.by": "published_at",
"sort.order": "desc",
"fl": "id,title,published_at,source.domain",
"api_key": "YOUR_API_KEY"
}};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
สูตรสำหรับ 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:13000000',
'published_at.start' => '2023-01-01',
'published_at.end' => '2023-12-31',
'per_page' => 100,
'page' => 1,
'sort.by' => 'published_at',
'sort.order' => 'desc',
'fl' => 'id,title,published_at,source.domain',
'api_key' => 'YOUR_API_KEY',
],
]);
echo $response->getBody();
สูตรสำหรับ 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%3A13000000&published_at.start=2023-01-01&published_at.end=2023-12-31&per_page=100&page=1&sort.by=published_at&sort.order=desc&fl=id%2Ctitle%2Cpublished_at%2Csource.domain&api_key=YOUR_API_KEY")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();