> ## 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.

# v1에서 v2로

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <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>;
};

<div id="manage-follows-standard-v11-compared-to-x-api-v2">
  #### 팔로우 관리: Standard v1.1과 X API v2 비교
</div>

표준 v1.1 [POST friendships/create](https://developer.x.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create) 및 [POST friendships/destroy](https://developer.x.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy) 엔드포인트를 사용해 왔다면, 이 가이드는 표준 v1.1 엔드포인트와 X API v2 팔로우 관리 엔드포인트 간의 유사점과 차이점을 이해하는 데 도움을 주기 위한 것입니다.

* **유사점**
  * OAuth 1.0a User Context
* **차이점**
  * 엔드포인트 URL
  * App 및 Project 요구 사항
  * HTTP 메서드
  * 요청 매개변수

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

**OAuth 1.0a User Context 인증 방식**

두 엔드포인트 버전 모두 [OAuth 1.0a User Context](/ko/resources/fundamentals/authentication#oauth-1-0a-2)를 지원합니다. 따라서 이전에 표준 v1.1 팔로우 관리 엔드포인트 중 하나를 사용해 왔다면, X API v2로 마이그레이션하더라도 동일한 인증 방식을 계속 사용할 수 있습니다.

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

**엔드포인트 URL**

* Standard v1.1 엔드포인트:
  * POST [https://api.x.com/1.1/friendships/create.json](https://api.x.com/1.1/friendships/create.json)
    (사용자 팔로우)
  * POST [https://api.x.com/1.1/friendships/destroy.json](https://api.x.com/1.1/friendships/destroy.json)
    (사용자 팔로우 해제)
* X API v2 엔드포인트:
  * POST [https://api.x.com/2/users/:id/following](https://api.x.com/2/users/:id/following)
    (사용자 팔로우)
  * DELETE [https://api.x.com/2/users/:source\&#95;user\&#95;id/following/:target\&#95;user\&#95;id](https://api.x.com/2/users/:source\&#95;user\&#95;id/following/:target\&#95;user\&#95;id)
    (사용자 팔로우 해제)

**App 및 Project 요구 사항**

X API v2 엔드포인트를 사용하려면, 요청을 인증할 때 [developer App](/ko/resources/fundamentals/developer-apps)과 연결된 [Project](/ko/resources/fundamentals/developer-apps)의 인증 정보를 사용해야 합니다. 모든 X API v1.1 엔드포인트는 Project에 연결된 App이든 아니든 App의 인증 정보를 사용할 수 있습니다.

**요청 파라미터**

다음 Standard v1.1 요청 파라미터에는 X API v2에서의 대응 항목이 있습니다:

| Standard v1.1 | X API v2                             |
| :------------ | :----------------------------------- |
| 해당 없음         | id (POST), source\_user\_id (DELETE) |
| user\_id      | target\_user\_id                     |
| screen\_name  | 해당 없음                                |

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

또한, Standard v1.1 엔드포인트를 사용할 때는 OAuth 1.0a User Context와 함께 전달된 Access Token을 통해 어떤 사용자가 팔로우/언팔로우를 시작했는지 유추할 수 있으므로, v2의 id 및 source\_user\_id는 필수 사항이 아닙니다.

***

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

<div id="follow-a-user-v2">
  ### 사용자 팔로우하기 (v2)
</div>

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

  ```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/following"
  response = requests.post(url, auth=auth, json={"target_user_id": "2244994945"})
  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.users.follow(
      source_user_id="123456789",
      target_user_id="2244994945"
  )
  print(f"Following: {response.data.following}")
  ```

  ```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.users.follow("123456789", {
    targetUserId: "2244994945",
  });
  console.log(`Following: ${response.data?.following}`);
  ```
</CodeGroup>

<div id="unfollow-a-user-v2">
  ### 사용자 언팔로우 (v2)
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.x.com/2/users/123456789/following/2244994945" \
    -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/following/2244994945"
  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.users.unfollow(
      source_user_id="123456789",
      target_user_id="2244994945"
  )
  print(f"Following: {response.data.following}")
  ```

  ```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.users.unfollow("123456789", "2244994945");
  console.log(`Following: ${response.data?.following}`);
  ```
</CodeGroup>
