本文へ移動

Zhihu カラム:記事詳細 API (V1) ​

GET
APIの健康状態
正常 利用可能 限られた数 ほとんど利用できない データなし
健康状態を読み込んでいます...

記事IDで識別されたZhihuコラム記事の詳細を取得します。既知の記事を読む、レビューする、またはアーカイブするために使用します。

パラメータ ​

名前 パラメーターの場所 タイプ 必須 デフォルト 説明
token query string はい - TOKEN
id query string はい - 記事ID

コードサンプル ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE'
text
私はJustOneAPIの"カラム:記事詳細 (V1)" APIを使用したいです。
基本URL: https://api.justoneapi.com.
APIパス: /api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE
APIエンドポイント: BASE_URL + /api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=VALUE
HTTPメソッド: GET
認証: "token"クエリパラメーターをURLに追加します。
OpenAPI定義: https://docs.justoneapi.com/openapi/zhihu/column-article-details-v1-ja.json

パラメーター:
- token (query): TOKEN (必須)
- id (query): 記事ID (必須)

返信形式:実際のContent-Typeに応じて、JSONまたはテキストを安全に処理する。

レスポンスの処理とエラーコード:
1. API の処理結果はレスポンス本文の「code」フィールドで判定します。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"  # オープンAPIサーバーによって提供される

url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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"; // オープンAPIサーバーによって提供される
const url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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"; // オープンAPIサーバーによって提供される
        final String url = BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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" // オープンAPIサーバーによって提供される

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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'; // オープンAPIサーバーによって提供される
$url = $BASE_URL . '/api/zhihu/get-column-article-detail/v1?token=YOUR_API_KEY&id=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;
}

レスポンスフィールド ​

成功したレスポンスのキーフィールド(code = 0)。

記事と本文9 項目

data

フィールド タイプ 説明
id string 知乎の記事ID、文字列として返される。
title string 記事のタイトル。
type string 知乎が報告するコンテンツエンティティタイプ。
article_type string 知乎が報告する記事カテゴリー。
url string 記事の知乎URLが返される。
excerpt string 記事の短い抜粋。
content string 記事本文がHTMLとして返される。
created integer 記事の作成時間がUnix秒で返される。
updated integer 記事の更新時間がUnix秒で返される。
著者10 項目

data.author

記事の著者の公開プロフィール情報。

フィールド タイプ 説明
id string ZhihuユーザーID、文字列として返される。
uid string Zhihuによって返される追加のユーザー識別子。
name string Zhihuアカウントの公開表示名。
headline string Zhihuプロフィールに表示される公開タイトル。
description string Zhihuプロフィールに表示される公開説明。
avatar_url string 公開プロフィールアバターのURL。
url string ユーザーに対して返されるZhihu URL。
type string Zhihuによって報告されるアカウントエンティティタイプ。
user_type string アカウントに対して返されるZhihuユーザーカテゴリ。
is_org boolean Zhihuがこれを組織アカウントとして報告するかどうか。
カバー画像4 項目

data

フィールド タイプ 説明
image_url string 記事の画像URL、利用可能な場合。
title_image string 記事のタイトル画像のURL(利用可能な場合)。
image_width integer 記事画像の報告された幅。
image_height integer 記事画像の報告された高さ。
関連する列27 項目

data

フィールド タイプ 説明
has_column boolean 記事がコラムと関連しているかどうか。
column object 関連するコラムがある場合はそのコラム。
column.id string ZhihuコラムID、文字列として返される。
column.title string コラムのタイトル。
column.intro string コラムの簡単な紹介。
column.description string コラムの説明。
column.url string コラムに対して返されるZhihu URL。
column.image_url string コラム画像のURL。
column.type string Zhihuによって報告されるコラムエンティティタイプ。
column.column_type string Zhihuによって報告されるコラムカテゴリ。
column.created integer コラムの作成時間(Unix秒)。
column.updated integer コラムの更新時間(Unix秒)。
column.followers integer コラムのフォロワー数(報告値)。
column.articles_count integer コラムの記事数(報告値)。
column.accept_submission boolean コラムが記事の投稿を受け付けるかどうか。
column.comment_permission string コメント権限設定が列として返されました。
column.author object 列の著者の公開プロフィール情報。
column.author.id string ZhihuユーザーID、文字列として返される。
column.author.uid string Zhihuによって返される追加のユーザー識別子。
column.author.name string Zhihuアカウントの公開表示名。
column.author.headline string Zhihuプロフィールに表示される公開タイトル。
column.author.description string Zhihuプロフィールに表示される公開説明。
column.author.avatar_url string 公開プロフィールアバターのURL。
column.author.url string ユーザーに対して返されるZhihu URL。
column.author.type string Zhihuによって報告されるアカウントエンティティタイプ。
column.author.user_type string アカウントに対して返されるZhihuユーザーカテゴリ。
column.author.is_org boolean Zhihuがこれを組織アカウントとして報告するかどうか。
列の貢献30 項目

data

フィールド タイプ 説明
contributions array 記事のコラム貢献記録。配列は空になることがあります。
contributions[].id integer 貢献記録の識別子。
contributions[].state string Zhihuが報告する貢献状態。
contributions[].type string Zhihuが報告する貢献エンティティのタイプ。
contributions[].column object この貢献に関連するコラム。
contributions[].column.id string ZhihuコラムID、文字列として返される。
contributions[].column.title string コラムのタイトル。
contributions[].column.intro string コラムの簡単な紹介。
contributions[].column.description string コラムの説明。
contributions[].column.url string コラムに対して返されるZhihu URL。
contributions[].column.image_url string コラム画像のURL。
contributions[].column.type string Zhihuによって報告されるコラムエンティティタイプ。
contributions[].column.column_type string Zhihuによって報告されるコラムカテゴリ。
contributions[].column.created integer コラムの作成時間(Unix秒)。
contributions[].column.updated integer コラムの更新時間(Unix秒)。
contributions[].column.followers integer コラムのフォロワー数(報告値)。
contributions[].column.articles_count integer コラムの記事数(報告値)。
contributions[].column.accept_submission boolean コラムが記事の投稿を受け付けるかどうか。
contributions[].column.comment_permission string コメント権限設定が列として返されました。
contributions[].column.author object 列の著者の公開プロフィール情報。
contributions[].column.author.id string ZhihuユーザーID、文字列として返される。
contributions[].column.author.uid string Zhihuによって返される追加のユーザー識別子。
contributions[].column.author.name string Zhihuアカウントの公開表示名。
contributions[].column.author.headline string Zhihuプロフィールに表示される公開タイトル。
contributions[].column.author.description string Zhihuプロフィールに表示される公開説明。
contributions[].column.author.avatar_url string 公開プロフィールアバターのURL。
contributions[].column.author.url string ユーザーに対して返されるZhihu URL。
contributions[].column.author.type string Zhihuによって報告されるアカウントエンティティタイプ。
contributions[].column.author.user_type string アカウントに対して返されるZhihuユーザーカテゴリ。
contributions[].column.author.is_org boolean Zhihuがこれを組織アカウントとして報告するかどうか。
トピック5 項目

data

フィールド タイプ 説明
topics array 記事に付随するトピック。
topics[].id string ZhihuのトピックID、文字列として返されます。
topics[].name string トピックの表示名。
topics[].type string Zhihuが報告するトピックエンティティのタイプ。
topics[].url string Zhihuのトピックに対するURLが返されます。
エンゲージメントとコメント11 項目

data

フィールド タイプ 説明
voteup_count integer 記事の賛成票数(報告値)。
liked_count integer 記事のいいね数(報告値)。
comment_count integer 記事のコメント数(報告値)。
favlists_count integer 記事を含むお気に入りリストの報告数。
tipjarors_count integer 記事に「いいね」をした人の報告数。
can_tip boolean 返される記事ビューで「いいね」が可能かどうか。
comment_permission string 記事のコメント権限設定が返されました。
admin_closed_comment boolean モデレーターによってコメントが閉じられているかどうか。
can_comment object 返される記事ビューでのコメントの利用可能性。
can_comment.status boolean 返される記事ビューでコメントが許可されているかどうか。
can_comment.reason string コメントの利用可能性状態についての説明が提供された場合。
状態と利用可能性7 項目

data

フィールド タイプ 説明
state string 知乎が報告する記事の状態。
is_visible boolean 返される記事の表示が「可視」としてマークされているかどうか。
ip_info string 記事に利用可能な場合、記事の公開場所の帰属テキストが表示される。
share_text string 記事を共有するための知乎が提供するテキスト。
content_need_truncated boolean 返される記事本文が短縮表示のためにマークされているかどうか。
force_login_when_click_read_more boolean 読むにはログインが必要かどうか、返される記事の表示が要求されるかどうか。
copyright_permission string 記事の著作権許可設定が返される。

レスポンス例 ​

レスポンスのサンプルを読み込んでいます...