บัญชี WeChat อย่างเป็นทางการ บทความในประวัติการเขียนของบัญชี API (V2)
สถานะสุขภาพของ API
สถานะดี มีสภาพ จำกัด ส่วนใหญ่ไม่มีสภาพ ไม่มีข้อมูล
กำลังโหลดสถานะสุขภาพ...
ดึงบทความย้อนหลังของบัญชีทางการ WeChat โดยระบุบัญชีด้วย ghid หรือ URL บทความ ใช้ค่าเคอร์เซอร์ออฟเซ็ตจากหน้าก่อนหน้าเพื่อดึงหน้าถัดไปในคลังบทความของบัญชี
เนื้อหาของคำขอ
| ชื่อ | ตำแหน่ง | ชนิดข้อมูล | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|---|
token |
form | string |
ใช่ | - | โทเค็นการเข้าถึงสำหรับบริการ API นี้ |
ghid |
form | string |
ไม่ใช่ | |
ตัวระบุบัญชี WeChat Official Account ต้นฉบับ โดยใช้คำนำหน้า gh_ จาก WeChat ใช้ either ghid หรือ url |
url |
form | string |
ไม่ใช่ | |
URL ของบทความบัญชี WeChat Official Account เพื่อระบุบัญชีและดึงข้อมูลบทความในอดีต ใช้ either ghid หรือ url |
offset |
form | string |
ไม่ใช่ | |
ใช้เคอร์เซอร์ PagingInfo.Offset ที่ได้จากผลตอบกลับก่อนหน้า เว้นค่าว่างสำหรับหน้าแรก สำหรับเอนด์พอยต์ POST นี้ ให้ส่งค่าในเนื้อหาคำขอแบบฟอร์ม application/x-www-form-urlencoded |
ตัวอย่างโค้ด
bash
curl --max-time 120 -X POST 'https://api.justoneapi.com/api/weixin/get-account-history-articles/v2' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'token=YOUR_API_KEY&ghid=&url=&offset='
text
ฉันต้องการใช้ API "บทความในประวัติการเขียนของบัญชี (V2)" จาก JustOneAPI.
URL หลัก: https://api.justoneapi.com.
เส้นทาง API: /api/weixin/get-account-history-articles/v2
เอนด์พอยต์ API: BASE_URL + /api/weixin/get-account-history-articles/v2
เมธอด HTTP: POST
การยืนยันตัวตน: ส่ง "token" ในรูปแบบการส่งข้อมูลแบบ application/x-www-form-urlencoded.
คำนิยาม OpenAPI: https://docs.justoneapi.com/openapi/wechat-official-accounts/account-historical-articles-v2-th.json
หัวข้อการขอ:
- Content-Type: application/x-www-form-urlencoded
เนื้อหาคำขอ (รูปแบบ Form):
- token (form): โทเค็นการเข้าถึงสำหรับบริการ API นี้ (จำเป็น)
- ghid (form): ตัวระบุบัญชี WeChat Official Account ต้นฉบับ โดยใช้คำนำหน้า gh_ จาก WeChat ใช้ either ghid หรือ url
- url (form): URL ของบทความบัญชี WeChat Official Account เพื่อระบุบัญชีและดึงข้อมูลบทความในอดีต ใช้ either ghid หรือ url
- offset (form): ใช้เคอร์เซอร์ PagingInfo.Offset ที่ได้จากผลตอบกลับก่อนหน้า เว้นค่าว่างสำหรับหน้าแรก สำหรับเอนด์พอยต์ POST นี้ ให้ส่งค่าในเนื้อหาคำขอแบบฟอร์ม application/x-www-form-urlencoded
รูปแบบที่ส่งกลับ: จัดการ JSON หรือข้อความอย่างปลอดภัยตามค่า Content-Type ที่ได้รับจริง
การจัดการผลตอบกลับและรหัสข้อผิดพลาด:
1. ตรวจสอบผลการทำงานจากฟิลด์ "code" ในผลตอบกลับ (รหัส 0 หมายถึงสำเร็จ)
2. แนะนำให้ตั้งระยะเวลารอ 120 วินาที หาก 120 วินาทีนานเกินไป ให้ตั้งอย่างน้อย 60 วินาที แต่คำขอบางรายการอาจหมดเวลาก่อนได้รับผลลัพธ์
3. รหัสผลลัพธ์:
- 0: สำเร็จ
- 100: โทเคนไม่ถูกต้องหรือถูกปิดใช้งาน
- 301: ดึงข้อมูลไม่สำเร็จ โปรดลองอีกครั้ง
- 302: เกินขีดจำกัดอัตราการเรียก
- 303: ใช้โควตารายวันครบแล้ว
- 400: พารามิเตอร์ไม่ถูกต้อง
- 500: ข้อผิดพลาดภายในเซิร์ฟเวอร์
- 600: ไม่มีสิทธิ์เข้าถึง
- 601: ยอดเงินคงเหลือไม่เพียงพอ
- 602: ถึงวงเงินของโทเคนแล้ว
4. รหัส 601 หมายถึงยอดเงินที่ใช้ร่วมกันของบัญชีไม่เพียงพอ รหัส 602 หมายถึงโทเคน API ถึงวงเงินสะสมของตนเองแล้ว การกำหนดวงเงินโทเคนจะไม่โอนเงินออกจากยอดเงินที่ใช้ร่วมกันของบัญชี
กรุณาช่วยเขียนสคริปต์ในภาษาโปรแกรมที่ฉันชื่นชอบเพื่อเรียกใช้ API และจัดการการตอบกลับ.
python
import requests
BASE_URL = "https://api.justoneapi.com" # ให้โดยเซิร์ฟเวอร์ OpenAPI
url = BASE_URL + "/api/weixin/get-account-history-articles/v2"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
data = "token=YOUR_API_KEY&ghid=&url=&offset="
response = requests.post(url, headers=headers, data=data, 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"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
const url = BASE_URL + "/api/weixin/get-account-history-articles/v2";
const response = await fetch(url, {
method: "POST",
headers: Object.fromEntries([
["Content-Type", "application/x-www-form-urlencoded"],
]),
body: "token=YOUR_API_KEY&ghid=&url=&offset=",
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"; // ให้โดยเซิร์ฟเวอร์ OpenAPI
final String url = BASE_URL + "/api/weixin/get-account-history-articles/v2";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.header("Content-Type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("token=YOUR_API_KEY&ghid=&url=&offset="));
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" // ให้โดยเซิร์ฟเวอร์ OpenAPI
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/weixin/get-account-history-articles/v2"
var data = strings.NewReader("token=YOUR_API_KEY&ghid=&url=&offset=")
req, _ := http.NewRequest("POST", url, data)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
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'; // ให้โดยเซิร์ฟเวอร์ OpenAPI
$url = $BASE_URL . '/api/weixin/get-account-history-articles/v2';
$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, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, 'token=YOUR_API_KEY&ghid=&url=&offset=');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded',
]);
$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;
}
ฟิลด์ที่ได้รับการตอบกลับ
ฟิลด์สำคัญในผลการตอบกลับที่สำเร็จ (code = 0).
บทความ10 ฟิลด์
data.MsgList.Msg[].AppMsg.DetailInfo[]
บทความหนึ่งในข้อความบทความ
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
ItemIndex |
integer |
ตำแหน่งของบทความนี้ในข้อความ ซึ่งตรงกับพารามิเตอร์ idx ใน URL ของบทความ |
Title |
string |
ชื่อบทความ |
Digest |
string |
บทสรุปบทความ ซึ่งอาจว่างเปล่า |
ShortShowDesc |
string |
คำอธิบายสั้นที่แสดงสำหรับบทความ ซึ่งอาจว่างเปล่า |
ContentUrl |
string |
URL บทความของ WeChat |
SourceUrl |
string |
ลิงก์แหล่งที่มาสำหรับบทความ ซึ่งอาจว่างเปล่า |
PublishTime |
string |
เวลาการเผยแพร่บทความในรูปแบบ YYYY-MM-DD HH:mm:ss (UTC+8) หากมีให้ |
send_time |
integer |
เวลาการเผยแพร่บทความในรูปแบบ Unix timestamp ในวินาที |
IsOriginal |
integer |
ค่าโปรตีนสำหรับตัวชี้วัดความแตกต่างของบทความ |
comment_topic_id |
integer |
ตัวระบุหัวข้อความคิดเห็นที่รายงานสำหรับบทความ. |
จำนวนการอ่านและความชื่นชอบ4 ฟิลด์
data.MsgList.Msg[].AppMsg.DetailInfo[]
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
Read |
integer |
ค่าความถี่ในการอ่านบทความที่รายงาน |
Zan |
integer |
จำนวนคนที่กดไลค์ในบทความที่รายงาน |
stat_info |
object |
สถิติบทความที่เลือกใช้ (Optional article statistics). |
stat_info.like_num |
integer |
จำนวนความนิยมที่รายงานในอ็อบเจกต์สถิติ ซึ่งอาจแตกต่างจาก Zan. |
ภาพปก12 ฟิลด์
data.MsgList.Msg[].AppMsg.DetailInfo[]
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
CoverImgUrl |
string |
URL ของภาพปกหลัก. |
CoverImgUrl_16_9 |
string |
URL ของภาพปกสำหรับเวอร์ชัน 16:9. |
CoverImgUrl_16_9_640 |
string |
URL ของภาพปกสำหรับเวอร์ชัน 16:9 ที่ระบุว่าเป็น 640. |
CoverImgUrl_1_1 |
string |
URL ของภาพปกสำหรับเวอร์ชันสี่เหลี่ยม. |
CoverImgUrl_235_1 |
string |
URL ของภาพปกสำหรับเวอร์ชัน 2.35:1. |
coverimgurl_3_4 |
string |
URL ของภาพปกสำหรับเวอร์ชัน 3:4. |
SuggestedCoverImg |
object |
ข้อแนะนำสำหรับภาพปกบทความและขนาดของภาพปก. |
SuggestedCoverImg.url |
string |
URL ของภาพปกที่แนะนำ. |
SuggestedCoverImg.width_hint |
integer |
ข้อแนะนำสำหรับความกว้างของภาพปกที่แนะนำ. |
SuggestedCoverImg.height_hint |
integer |
ข้อแนะนำสำหรับความสูงของภาพปกที่แนะนำ. |
preload_picture_info |
object |
ข้อมูลภาพที่รายงานสำหรับการโหลดก่อนหน้า. |
preload_picture_info.cdn_url |
string |
URL CDN สำหรับภาพที่โหลดก่อนหน้า. |
กลุ่มข้อความ12 ฟิลด์
data.MsgList.Msg[]
กลุ่มข้อความทางประวัติศาสตร์หนึ่ง
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
BaseInfo |
object |
ข้อมูลสารสนเทศสำหรับกลุ่มข้อความนี้ |
BaseInfo.MsgId |
integer |
ตัวระบุของกลุ่มข้อความทางประวัติศาสตร์ |
BaseInfo.DateTime |
integer |
เวลาที่รายงานสำหรับกลุ่มข้อความนี้ ในหน่วยวินาทีตาม Unix |
BaseInfo.MsgType |
integer |
ค่าโปรตีนสำหรับประเภทข้อความที่รายงานสำหรับกลุ่มข้อความนี้ |
BaseInfo.UniqueId |
string |
ตัวระบุข้อความสำหรับกลุ่มข้อความนี้ |
AppMsg |
object |
ข้อความบทความที่มีข้อมูลสารสนเทศและบทความแต่ละบทความ |
AppMsg.BaseInfo |
object |
ข้อมูลสารสนเทศสำหรับข้อความบทความ |
AppMsg.BaseInfo.AppMsgId |
integer |
ตัวระบุข้อความบทความ ซึ่งตรงกับพารามิเตอร์ mid ใน URL ของบทความ |
AppMsg.BaseInfo.Type |
integer |
ค่าโปรตีนสำหรับประเภทข้อความที่รายงานสำหรับข้อความบทความ |
AppMsg.BaseInfo.CreateTime |
integer |
เวลาการสร้างข้อความบทความที่รายงาน ในหน่วยวินาทีตาม Unix |
AppMsg.BaseInfo.UpdateTime |
integer |
เวลาการอัปเดตข้อความบทความที่รายงาน ในหน่วยวินาทีตาม Unix |
AppMsg.DetailInfo |
array |
บทความแต่ละบทความที่ถูกรวมอยู่ภายใต้ข้อความบทความนี้ |
การแสดงผลแบบแบ่งหน้า6 ฟิลด์
data
ข้อความและการแสดงหน้าในประวัติศาสตร์สำหรับบัญชี WeChat ทางการที่ขอมา
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
MsgList.PagingInfo |
object |
ข้อมูลการแสดงผลการแสดงผลในลำดับข้อความ. |
MsgList.PagingInfo.Offset |
string |
ข้อความของคอร์เซอร์ที่รายงานในลำดับข้อความ. |
MsgList.PagingInfo.IsEnd |
integer |
สัญลักษณ์บอกว่าลำดับข้อความสิ้นสุดแล้วที่รายงานในลำดับข้อความ. |
PagingInfo |
object |
ข้อมูลการแสดงผลการแสดงผลสำหรับการตอบกลับ. ใช้ค่า Offset ของอ็อบเจกต์นี้สำหรับการขอข้อมูลครั้งต่อไป. |
PagingInfo.Offset |
string |
คอร์เซอร์แบบไม่โปร่งใสสำหรับหน้าถัดไป. ส่งค่า Offset นี้มาโดยไม่เปลี่ยนแปลง. |
PagingInfo.IsEnd |
integer |
ค่าสัญลักษณ์บอกว่าลำดับข้อมูลสิ้นสุดแล้ว. หน้าที่สามารถดำเนินต่อไปได้จะส่งค่า 0. |
รายชื่อข้อความและหัวข้อ4 ฟิลด์
data
ข้อความและข้อมูลที่เกี่ยวข้องในประวัติศาสตร์ที่ส่งกลับมาสำหรับหน้านี้
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
MsgList.Msg |
array |
กลุ่มข้อความที่ส่งกลับมาในหน้านี้ แต่ละข้อความอาจมีหลายบทความ |
MsgList.FeaturedList |
array |
รายการผลิตภัณฑ์ที่ได้รับการแนะนำที่ส่งมาพร้อมกับหน้าแสดงข้อความ ซึ่งอาจว่างเปล่า. |
MsgList.FeaturedUpdateTime |
integer |
เวลาแสดงผลการอัปเดตสำหรับรายการผลิตภัณฑ์ที่ได้รับการแนะนำ โดยแสดงเป็นวินาทีใน Unix. |
TopicList |
array |
รายการหัวข้อที่ส่งมาพร้อมกับการตอบกลับ. อาจว่างเปล่า. |
ประวัติการใช้งานบัญชี9 ฟิลด์
data
| ฟิลด์ | ชนิดข้อมูล | คำอธิบาย |
|---|---|---|
AccountInfo |
object |
โปรไฟล์สาธารณะของบัญชี WeChat ทางการ |
AccountInfo.UserName |
string |
ตัวระบุบัญชี WeChat ทางการที่มีคำนำหน้า gh_ |
AccountInfo.NickName |
string |
ชื่อที่ปรากฏบนหน้าแสดงผลของบัญชี WeChat ทางการ |
AccountInfo.HeadImgUrl |
string |
URL ของภาพโปรไฟล์ของบัญชี WeChat ทางการ |
AccountInfo.ServiceType |
integer |
รหัสประเภทบัญชีที่เป็นตัวเลขที่รายงานสำหรับโปรไฟล์นี้ |
HasArtile |
boolean |
ว่าบัญชีมีบทความหรือไม่ ตามที่ API รายงาน |
IPWording |
string |
ป้ายกำกับตำแหน่ง IP ที่แสดงสำหรับบัญชี |
BanReason |
array |
เหตุผลของการจำกัดบัญชีเมื่อมีการระบุ. อาร์เรย์อาจว่างเปล่า. |
VideoFinderInfo |
object |
ข้อมูลช่อง WeChat หากมีให้ วัตถุนี้อาจว่างเปล่าได้ |
ตัวอย่างผลการตอบกลับ
กำลังโหลดตัวอย่างการตอบกลับ...