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

# 리트윗 관리

<div id="manage-retweets-standard-v11-compared-to-x-api-v2">
  ### 리트윗 관리: 표준 v1.1과 X API v2 비교
</div>

표준 v1.1의 [POST statuses/retweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id), [POST statuses/unretweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id) 엔드포인트를 사용해 왔다면, 이 가이드는 표준과 X API v2 리트윗 엔드포인트 간의 유사점과 차이점을 이해하는 데 도움이 되도록 작성되었습니다.

* **유사점**
  * 인증
* **차이점**
  * 엔드포인트 URL 및 HTTP 메서드
  * 요청 한도
  * App 및 Project 요구 사항
  * 요청 파라미터

<div id="similarities">
  #### 유사점
</div>

**인증**

표준 v1.1과 X API v2에서 Retweet을 관리하는 엔드포인트([POST statuses/retweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id), [POST statuses/unretweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id))는 모두 [OAuth 1.0a User Context](https://developer.x.com/content/developer-twitter/resources/fundamentals/authentication)를 사용합니다. 따라서 이전에 표준 v1.1 Retweet 조회 엔드포인트를 사용하고 있었다면, X API v2로 마이그레이션하더라도 동일한 인증 방식을 계속 사용할 수 있습니다. 

<div id="differences">
  #### 차이점
</div>

**엔드포인트 URL 및 HTTP 메서드**

* Standard v1.1 엔드포인트:
  * [https://api.x.com/1.1/statuses/retweet/:id.json](https://api.x.com/1.1/statuses/retweet/:id.json)
    (게시물을 리트윗합니다. 리트윗 정보가 포함된 원본 게시물을 반환합니다)
  * [https://api.x.com/1.1/statuses/unretweet/:id.json](https://api.x.com/1.1/statuses/unretweet/:id.json)
    (리트윗을 취소합니다. 리트윗 정보가 포함된 원본 게시물을 반환합니다)
* X API v2 엔드포인트:
  * [https://api.x.com/2/tweets/:id/retweets](https://api.x.com/2/tweets/:id/retweets)
    (지정된 게시물을 리트윗합니다)
  * [https://api.x.com/2/users/:id/retweets/:source\&#95;tweet\&#95;id](https://api.x.com/2/users/:id/retweets/:source\&#95;tweet\&#95;id)
    (지정된 게시물의 리트윗을 취소합니다) 

**App 및 Project 요구 사항**

X API v2 엔드포인트는 요청을 인증할 때, 해당 [Project](/ko/resources/fundamentals/developer-apps)에 연결된 [developer App](/ko/resources/fundamentals/developer-apps)의 자격 증명을 사용해야 합니다. 모든 X API v1.1 엔드포인트는 App 자체의 자격 증명 또는 Project와 연결된 App의 자격 증명을 사용할 수 있습니다.

**요청 파라미터**

다음 Standard v1.1 요청 파라미터는 두 개의 쿼리 파라미터(user\_id 또는 screen\_name)를 허용했습니다. X API v2는 숫자형 user ID만 허용하며, 엔드포인트 경로의 일부로 전달되어야 합니다.

| Standard v1.1          | X API v2 |
| :--------------------- | :------- |
| **id**                 | **id**   |
| **includes\_entities** | 해당 없음    |

Standard v1.1의 파라미터는 쿼리 파라미터로 전달되는 반면, X API v2의 파라미터는 POST 엔드포인트에서는 본문(body) 파라미터로, DELETE 엔드포인트에서는 경로(path) 파라미터로 전달된다는 점에 유의하세요.

또한, Standard v1.1 엔드포인트를 사용할 때는 [OAuth 1.0a User Context](/ko/resources/fundamentals/authentication)와 함께 전달된 [Access Tokens](/ko/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow)를 통해 리트윗 또는 리트윗 취소를 수행하는 사용자를 유추할 수 있으므로, 게시물을 리트윗하는 사용자의 id를 별도로 지정할 필요가 없습니다.

***

<div id="code-examples">
  ## 코드 예시
</div>

<div id="retweet-a-post-v2">
  ### 게시물 리트윗하기 (v2)
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X POST "https://api.x.com/2/users/123456789/retweets" \
    -H "Authorization: OAuth ..." \
    -H "Content-Type: application/json" \
    -d '{"tweet_id": "1234567890"}'
  ```

  ```python Python theme={null}
  # OAuth 1.0a 사용자 컨텍스트 인증이 필요합니다.
  import requests
  from requests_oauthlib import OAuth1

  auth = OAuth1(
      "API_KEY", "API_SECRET",
      "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"
  )

  url = "https://api.x.com/2/users/123456789/retweets"
  response = requests.post(url, auth=auth, json={"tweet_id": "1234567890"})
  print(response.json())
  ```

  ```python Python SDK theme={null}
  from xdk import Client
  from xdk.oauth1_auth import OAuth1

  oauth1 = OAuth1(
      api_key="YOUR_API_KEY",
      api_secret="YOUR_API_SECRET",
      access_token="YOUR_ACCESS_TOKEN",
      access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
  )

  client = Client(auth=oauth1)

  # 게시물을 리트윗합니다.
  response = client.posts.retweet(user_id="123456789", tweet_id="1234567890")
  print(f"Retweeted: {response.data.retweeted}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client, OAuth1 } from "@xdevplatform/xdk";

  const oauth1 = new OAuth1({
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET",
    accessToken: "YOUR_ACCESS_TOKEN",
    accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
  });

  const client = new Client({ oauth1 });

  // 게시물을 리트윗합니다.
  const response = await client.posts.retweet("123456789", { tweetId: "1234567890" });
  console.log(`Retweeted: ${response.data?.retweeted}`);
  ```
</CodeGroup>

<div id="undo-a-retweet-v2">
  ### 리트윗 취소 (v2)
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.x.com/2/users/123456789/retweets/1234567890" \
    -H "Authorization: OAuth ..."
  ```

  ```python Python theme={null}
  # OAuth 1.0a 사용자 컨텍스트 인증이 필요합니다
  import requests
  from requests_oauthlib import OAuth1

  auth = OAuth1(
      "API_KEY", "API_SECRET",
      "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"
  )

  url = "https://api.x.com/2/users/123456789/retweets/1234567890"
  response = requests.delete(url, auth=auth)
  print(response.json())
  ```

  ```python Python SDK theme={null}
  from xdk import Client
  from xdk.oauth1_auth import OAuth1

  oauth1 = OAuth1(
      api_key="YOUR_API_KEY",
      api_secret="YOUR_API_SECRET",
      access_token="YOUR_ACCESS_TOKEN",
      access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
  )

  client = Client(auth=oauth1)

  # 리트윗 취소
  response = client.posts.unretweet(user_id="123456789", tweet_id="1234567890")
  print(f"Retweeted: {response.data.retweeted}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client, OAuth1 } from "@xdevplatform/xdk";

  const oauth1 = new OAuth1({
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET",
    accessToken: "YOUR_ACCESS_TOKEN",
    accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
  });

  const client = new Client({ oauth1 });

  // 리트윗 취소
  const response = await client.posts.unretweet("123456789", "1234567890");
  console.log(`Retweeted: ${response.data?.retweeted}`);
  ```
</CodeGroup>
