querystringbắt buộc
Keyword or phrase to search Facebook posts for (e.g. 'product launch').
https://api.sandbase.ai/v1/api/facebook/search-postsSearch public Facebook posts by keyword, optionally filtered by location, and get structured post records (text, author, engagement).
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
Returns public Facebook posts that match a keyword or phrase. Each record has the post text, the author, a post URL, and reaction, comment and share counts. The only required input is query, and you can narrow results with location, startDate and endDate.
reactionCount, commentCount and shareCount across posts to find the ones that got the most engagement.authorName and authorUrl from the results.location to a value like Paris, France.curl -X POST "https://api.sandbase.ai/v1/api/facebook/search-posts" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"limit": 3, "query": "nike"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Keyword or phrase to search Facebook posts for (e.g. 'product launch'). |
endDate | string | No | Only return posts published on or before this date, format YYYY-MM-DD (e.g. 2024-12-31). |
limit | integer | No | Maximum number of results to return (1-20, default 20). |
location | string | No | Optional place name; include both city and country for best matches (e.g. 'Paris, France'). Uses Facebook's place filter, which favors posts tagged at that place rather than every post by people who live there, and can s |
requireFields | array | No | Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example imagesCount or albumPreview, and it is served only by a source tha |
startDate | string | No | Only return posts published on or after this date, format YYYY-MM-DD (e.g. 2024-01-01). |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"items": [
{
"authorId": "100044541544829",
"authorImage": "https://scontent.fdtw2-1.fna.fbcdn.net/v/t39.30808-1/284964043_10159903868513445…",
"authorName": "Nike",
"authorUrl": "https://www.facebook.com/nike",
"commentCount": 2882,
"createdUtc": 1509595630,
"id": "10155532600988445",
"image": "https://scontent.fdtw2-1.fna.fbcdn.net/v/t39.30808-6/468501570_10162044654548445…",
"imagesCount": null,
"reactionCount": 6019,
"reactions": {
"angry": 8,
"care": 0,
"haha": 15,
"like": 4944,
"love": 1015,
"sad": 5,
"wow": 32
},
"shareCount": 9413
}
]
},
"found": true
}
| Field | Meaning |
|---|---|
data.items[].id | ID of the post. |
data.items[].url | Link to the post on Facebook. |
data.items[].text | Text of the post. Long text may be cut in the response. |
data.items[].authorName / data.items[].authorUrl | Display name and Facebook URL of the page or profile that wrote the post. |
data.items[].authorId | ID of the author. |
data.items[].createdUtc | Time the post was created, as a Unix timestamp in seconds. |
data.items[].reactionCount | Total reactions on the post. |
data.items[].reactions.like / reactions.love / reactions.haha / reactions.wow / reactions.sad / reactions.angry / reactions.care | Count of each reaction type on the post. |
data.items[].commentCount / data.items[].shareCount | Number of comments and shares on the post. |
data.items[].image | URL of the post image. It is an empty string when the post has no image. |
limit to set how many posts come back, from 1 to 20. The default is 20.startDate and endDate use the YYYY-MM-DD format.imagesCount can be null. To require it, or albumPreview or type, list the name in requireFields. A dearer source may then serve the call, which can raise the price.Billed at the actual cost of each call, about $0.03 for the request above. Failed calls are not charged.
Bắt đầu xây dựng
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/facebook/search-posts" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"limit": 3,
"query": "nike"
}'Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
querystringbắt buộcKeyword or phrase to search Facebook posts for (e.g. 'product launch').
limitintegerMaximum number of results to return (1-20, default 20).
endDatestringOnly return posts published on or before this date, format YYYY-MM-DD (e.g. 2024-12-31).
locationstringOptional place name; include both city and country for best matches (e.g. 'Paris, France'). Uses Facebook's place filter, which favors posts tagged at that place rather than every post by people who live there, and can still return some posts from elsewhere.
startDatestringOnly return posts published on or after this date, format YYYY-MM-DD (e.g. 2024-01-01).
requireFieldsarrayOptional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `imagesCount` or `albumPreview`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
Chưa có phản hồi đã lưu nào được công bố. Chạy API trong Playground để xem phản hồi.
Khám phá thêm
| API | Giá | Phản hồi |
|---|---|---|
Facebook Post SearchAPI này Facebook | Từ $0.03 mỗi lần gọi | JSON |
Facebook | Từ $0.0012 mỗi lần gọi | JSON |
Facebook | Từ $0.00462 mỗi lần gọi | JSON |
Facebook | Từ $0.0012 mỗi lần gọi | JSON |
Facebook | Từ $0.0011 mỗi lần gọi | JSON |
Facebook | Từ $0.0011 mỗi lần gọi | JSON |
Câu hỏi
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/facebook/search-posts với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
Từ $0.03 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
Bắt buộc: query (string). Tùy chọn: limit (integer), endDate (string), location (string), startDate (string) và requireFields (array). Bảng Parameters và Playground trên trang này liệt kê mọi trường.
Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.
Không. Facebook Post Search chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của Facebook.