> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# クイックスタート

> このガイドでは、Quote Posts(他の投稿を引用した投稿)の取得方法を説明します。quote tweets を扱う X API v2 スタンダードティアのリファレンス。

export const Button = ({href, children}) => {
  return <div className="not-prose">
    <a href={href}>
      <button className="x-btn">
        <span>{children}</span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

このガイドでは、Quote Posts(他の投稿を引用した投稿)の取得方法を説明します。

<Note>
  **前提条件**

  始める前に以下が必要です:

  * 承認済みの App を含む[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App の Bearer Token
</Note>

***

<Steps>
  <Step title="投稿 ID を見つける" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-chat.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=9fde7d51b4f18c96d3a38a81d519761f" width="24" height="24" data-path="icons/xds/icon-chat.svg">
    引用を検索したい投稿の ID を取得します。投稿の URL から確認できます:

    ```
    https://x.com/XDevelopers/status/1409931481552543749
                                    └── これが投稿 ID
    ```
  </Step>

  <Step title="Quote Posts をリクエストする" icon="terminal">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/tweets/1409931481552543749/quote_tweets?\
      tweet.fields=created_at,public_metrics,author_id&\
      expansions=author_id&\
      user.fields=username,verified&\
      max_results=10" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python title="Python SDK" lines wrap icon="python" theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # ページネーションで Quote Posts を取得
      for page in client.posts.get_quote_tweets(
          "1409931481552543749",
          tweet_fields=["created_at", "public_metrics", "author_id"],
          expansions=["author_id"],
          user_fields=["username", "verified"],
          max_results=10
      ):
          for post in page.data:
              print(f"{post.text[:50]}... - Likes: {post.public_metrics.like_count}")
      ```

      ```javascript title="JavaScript SDK" lines wrap icon="square-js" theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      // ページネーションで Quote Posts を取得
      const paginator = client.posts.getQuoteTweets("1409931481552543749", {
        tweetFields: ["created_at", "public_metrics", "author_id"],
        expansions: ["author_id"],
        userFields: ["username", "verified"],
        maxResults: 10,
      });

      for await (const page of paginator) {
        page.data?.forEach((post) => {
          console.log(`${post.text?.slice(0, 50)}... - Likes: ${post.public_metrics?.like_count}`);
        });
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="レスポンスを確認する" icon="eye">
    ```json theme={null}
    {
      "data": [
        {
          "id": "1495979553889697792",
          "text": "Great thread on the new API features! https://t.co/...",
          "author_id": "29757971",
          "created_at": "2022-02-22T04:31:34.000Z",
          "public_metrics": {
            "retweet_count": 5,
            "reply_count": 2,
            "like_count": 42,
            "quote_count": 1
          },
          "edit_history_tweet_ids": ["1495979553889697792"]
        }
      ],
      "includes": {
        "users": [
          {
            "id": "29757971",
            "username": "developer",
            "verified": false
          }
        ]
      },
      "meta": {
        "result_count": 1,
        "next_token": "avdjwk0udyx6"
      }
    }
    ```
  </Step>

  <Step title="結果をページネーションする" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=88e933002782dbdeb204043cedef033e" width="24" height="24" data-path="icons/xds/icon-arrow-right.svg">
    SDK はページネーションを自動的に処理します。cURL の場合、`next_token` を使用してさらに多くの Quote Posts を取得します:

    ```bash theme={null}
    curl "https://api.x.com/2/tweets/1409931481552543749/quote_tweets?\
    max_results=10&\
    pagination_token=avdjwk0udyx6" \
      -H "Authorization: Bearer $BEARER_TOKEN"
    ```
  </Step>
</Steps>

***

## 次のステップ

<CardGroup cols={2}>
  <Card title="Retweets" icon="retweet" href="/x-api/posts/retweets/introduction">
    Retweet をルックアップ
  </Card>

  <Card title="Post lookup" icon="https://mintcdn.com/x-preview/cfyQtgCdwk8p69aa/icons/xds/icon-search.svg?fit=max&auto=format&n=cfyQtgCdwk8p69aa&q=85&s=8c11ad89387b7c09ced1553d5c232834" href="/x-api/posts/lookup/introduction" width="24" height="24" data-path="icons/xds/icon-search.svg">
    ID で投稿をルックアップ
  </Card>

  <Card title="API リファレンス" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/posts/get-quoted-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>
