Lewati ke konten

Facebook Dapatkan Artikel Profil API (V1) ​

GET
Status kesehatan API
Sehat Tersedia Terbatas Sebagian besar tidak tersedia Tidak ada data
Memuat status kesehatan...

Mengambil postingan publik untuk ID profil Facebook dengan paginasi kursor. Digunakan untuk melihat sejarah postingan publik dari profil yang diketahui atau melanjutkan ke halaman postingan berikutnya.

Parameter ​

Nama Lokasi Jenis Wajib Bawaan Deskripsi
token query string Ya - Token keamanan pengguna untuk autentikasi akses API.
profileId query string Ya - ID unik profil Facebook.
cursor query string Tidak Kursor paginasi untuk mengambil hasil perhitungan berikutnya.

Contoh Kode ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE'
text
Saya ingin menggunakan API "Dapatkan Artikel Profil (V1)" dari JustOneAPI.
URL dasar: https://api.justoneapi.com.
Jalur API: /api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE
Endpoint API: BASE_URL + /api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE
Metode HTTP: GET
Autentikasi: Tambahkan parameter query "token" ke URL.
Definisi OpenAPI: https://docs.justoneapi.com/openapi/facebook/get-profile-posts-v1-id.json

Parameter:
- token (query): Token keamanan pengguna untuk autentikasi akses API. (Wajib)
- profileId (query): ID unik profil Facebook. (Wajib)
- cursor (query): Kursor paginasi untuk mengambil hasil perhitungan berikutnya.

Format Kembalian: tangani dengan aman JSON atau teks sesuai dengan Content-Type yang sebenarnya.

Penanganan respons dan kode kesalahan:
1. Tentukan hasil pemrosesan dari kolom "code" dalam isi respons (code 0 berarti berhasil).
2. Batas waktu yang disarankan: Atur batas waktu permintaan menjadi 120 detik. Jika 120 detik terlalu lama untuk kebutuhan Anda, gunakan setidaknya 60 detik. Sebagian kecil permintaan mungkin mencapai batas waktu sebelum hasil diterima.
3. Kode hasil:
   - 0: Berhasil
   - 100: Token tidak valid atau tidak aktif
   - 301: Gagal mengambil data. Silakan coba lagi.
   - 302: Batas frekuensi permintaan terlampaui
   - 303: Kuota harian terlampaui
   - 400: Parameter tidak valid
   - 500: Kesalahan internal server
   - 600: Akses ditolak
   - 601: Saldo tidak mencukupi
   - 602: Batas anggaran token tercapai
4. Kode 601 berarti saldo bersama akun tidak mencukupi. Kode 602 berarti token API yang digunakan telah mencapai batas anggaran kumulatifnya sendiri. Menetapkan batas anggaran token tidak memindahkan dana dari saldo bersama akun.

Tolong bantu saya menulis skrip dalam bahasa pemrograman favorit saya untuk memanggil API ini dan menangani responsnya.
python
import requests

BASE_URL = "https://api.justoneapi.com"  # Diberikan oleh server OpenAPI

url = BASE_URL + "/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // Diberikan oleh server OpenAPI
const url = BASE_URL + "/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // Diberikan oleh server OpenAPI
        final String url = BASE_URL + "/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // Diberikan oleh server OpenAPI

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // Diberikan oleh server OpenAPI
$url = $BASE_URL . '/api/facebook/get-profile-posts/v1?token=YOUR_API_KEY&profileId=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

Field Respons ​

Field Kunci dalam respons yang sukses (code = 0).

Artikel dan paginasi2 kolom

data

Postingan profil Facebook publik dan informasi lanjutan.

Kolom Jenis Deskripsi
results array Postingan publik yang dikirim untuk profil ini. Daftar bisa kosong.
cursor string | null Pass dikembalikan tanpa perubahan sebagai parameter permintaan kursor untuk profil yang sama. Null berarti tidak ada hasil yang dikembalikan.
Konten Unggahan9 kolom

data.results[]

Satu postingan publik yang dikirim untuk profil ini.

Kolom Jenis Deskripsi
post_id string Identifikasi postingan di Facebook.
type string Jenis catatan yang dikirim. Hasil yang terverifikasi menggunakan “post”.
url string Link publik ke postingan di Facebook.
message string | null Teks pesan postingan, atau null jika tidak tersedia.
message_rich string | null Teks pesan yang diformat seperti yang dikirim, atau null jika tidak tersedia.
timestamp integer Waktu publikasi postingan dalam format timestamp Unix dalam detik.
text_format_metadata - Metadata format teks postingan. Sample yang terverifikasi mengembalikan null.
was_detected_as_ai_generated - Penanda platform untuk konten yang dideteksi sebagai hasil AI. Contoh yang terverifikasi mengembalikan null.
was_self_disclosed_as_ai_generated - Penanda pengungkapan penulis untuk konten yang dihasilkan AI. Contoh yang terverifikasi mengembalikan null.
Keterlibatan dan reaksi13 kolom

data.results[]

Kolom Jenis Deskripsi
comments_count integer Jumlah komentar yang dilaporkan untuk postingan ini.
reactions_count integer Jumlah total reaksi terhadap postingan yang dilaporkan.
reshare_count integer Jumlah kali postingan dipublikasikan ulang yang dilaporkan.
reactions object Jumlah reaksi untuk setiap jenis reaksi yang dilaporkan.
reactions.angry integer Jumlah reaksi “Angry”.
reactions.care integer Jumlah reaksi “Care”.
reactions.haha integer Jumlah reaksi “Haha”.
reactions.like integer Jumlah reaksi “Like”.
reactions.love integer Jumlah reaksi “Love”.
reactions.sad integer Jumlah reaksi “Sad”.
reactions.wow integer Jumlah reaksi “Wow”.
comments_id string Identifikasi yang dilaporkan untuk konteks komentar postingan ini.
shares_id string Identifikasi yang dilaporkan untuk konteks berbagi postingan ini.
Penulis postingan14 kolom

data.results[]

Kolom Jenis Deskripsi
author object Penulis utama postingan tersebut.
author.id string Identifikasi profil Facebook.
author.name string Nama tampilan publik dari profil tersebut.
author.url string Link publik ke profil Facebook.
author.profile_picture_url string URL gambar profil yang diberikan untuk penulis ini.
author.delegate_page_id string | null Identifikasi halaman Facebook yang dilaporkan untuk penulis yang diberi wewenang, jika tersedia.
authors array Penulis publik yang terkait dengan postingan tersebut.
authors[] object Satu penulis publik yang terkait dengan postingan tersebut.
authors[].id string Identifikasi profil Facebook.
authors[].name string Nama tampilan publik dari profil tersebut.
authors[].url string Link publik ke profil Facebook.
authors[].profile_picture_url string URL gambar profil yang diberikan untuk penulis ini.
authors[].delegate_page_id string | null Identifikasi halaman Facebook yang dilaporkan untuk penulis yang diberi wewenang, jika tersedia.
author_title - Informasi judul untuk penulis postingan. Sample yang terverifikasi mengembalikan null.
Gambar dan video21 kolom

data.results[]

Kolom Jenis Deskripsi
image object | null Detail lampiran berupa satu gambar, atau null jika tidak tersedia.
image.uri string URL gambar terlampir.
image.height integer Tinggi gambar yang dilampirkan dalam piksel.
image.width integer Lebar gambar yang dilampirkan dalam piksel.
image.id string Pengenal gambar terlampir.
video string | null Link Facebook ke video yang dilampirkan, atau null jika tidak tersedia.
video_view_count integer | null Jumlah penonton video yang dilaporkan, atau null jika tidak tersedia.
album_preview array | null Preview lampiran dalam album postingan, atau null jika tidak tersedia.
album_preview[] object Satu preview lampiran, seperti foto atau video.
album_preview[].type string Jenis preview lampiran. Preview yang terverifikasi termasuk foto dan video.
album_preview[].image_file_uri string URL gambar preview.
album_preview[].url string Link publik Facebook ke preview lampiran.
album_preview[].id string Identifikasi preview lampiran.
album_preview[].video_sd_file string URL file video definisi tinggi yang diberikan untuk preview ini.
album_preview[].video_hd_file string URL file video high-definition yang diberikan untuk preview ini.
album_preview[].video_id string Identifikasi video Facebook yang diberikan untuk preview.
video_files object | null Link file video yang terkait dengan postingan, atau null jika tidak tersedia.
video_files.video_sd_file string URL file video definisi tinggi yang diberikan untuk postingan.
video_files.video_hd_file string URL file video berdefinisi tinggi dikembalikan untuk postingan tersebut.
video_thumbnail string | null URL thumbnail video, atau null jika tidak tersedia.
images_count integer | null Jumlah gambar yang dilaporkan untuk postingan, atau null jika tidak tersedia.
Postingan dan tautan yang dikirim18 kolom

data.results[]

Kolom Jenis Deskripsi
external_url string | null Link eksternal yang terkait dengan postingan tersebut, atau null jika tidak tersedia.
attached_event - Informasi lampiran acara. Sample yang terverifikasi mengembalikan null.
attached_group - Informasi lampiran grup. Sample yang terverifikasi mengembalikan null.
attached_post object | null Detail postingan Facebook yang terkait dengan postingan ini, atau null jika tidak tersedia.
attached_post.post_id string Identifikasi postingan Facebook yang terkait.
attached_post.url string Link publik ke postingan Facebook yang terkait.
attached_post.timestamp - Waktu penulisan postingan yang terkait. Sample yang terverifikasi mengembalikan null.
attached_post.message string | null Teks postingan yang terkait, atau null jika tidak tersedia.
attached_post.photo_url - Link foto untuk postingan yang terkait. Sample yang terverifikasi mengembalikan null.
attached_post.author object Detail penulis publik untuk postingan yang terkait.
attached_post.author.id string Identifikasi profil Facebook.
attached_post.author.name string Nama tampilan publik dari profil tersebut.
attached_post.author.url string Link publik ke profil Facebook.
attached_post.video_url string | null Link video untuk postingan yang terkait, atau null jika tidak tersedia.
attached_post.album_url - Link album untuk postingan yang terkait. Sample yang terverifikasi mengembalikan null.
attached_post_url string | null Link ke postingan yang terkait, atau null jika tidak tersedia.
associated_group_id - Informasi identifikasi untuk grup yang terkait dengan postingan ini. Sample yang terverifikasi mengembalikan null.
associated_group - Informasi tentang grup Facebook yang terkait dengan postingan ini. Sample yang terverifikasi mengembalikan null.
Komentar yang ditekankan13 kolom

data.results[]

Kolom Jenis Deskripsi
top_comments array Komentar yang ditandai sebagai penting diberikan bersama postingan. Daftar dapat kosong.
top_comments[] object Satu komentar yang ditandai sebagai penting diberikan bersama postingan.
top_comments[].type string Tipe catatan komentar. Rekaman yang terverifikasi menggunakan top_comment.
top_comments[].id string Identifikasi komentar yang ditandai sebagai penting.
top_comments[].legacy_fb_id string Identifikasi lama dari komentar di Facebook.
top_comments[].text string Teks komentar yang ditandai.
top_comments[].author object Informasi penulis publik yang dikembalikan untuk komentar tersebut.
top_comments[].author.id string Identifikasi profil Facebook.
top_comments[].author.name string Nama tampilan publik dari profil tersebut.
top_comments[].author.url string Link publik ke profil Facebook.
top_comments[].author.gender string Label jenis kelamin yang dilaporkan untuk penulis komentar.
top_comments[].author.profile_image_url string URL gambar profil yang dikembalikan untuk penulis komentar.
top_comments[].created_time integer Waktu publikasi komentar sebagai tanda waktu Unix dalam detik.

Contoh Respons ​

Memuat contoh respons...