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

# API

> JSON 요청 본문과 함께 경로로 모든 PlayFab API 엔드포인트를 직접 호출합니다.

`playfab api`는 경로로 모든 PlayFab API 엔드포인트를 호출하고, 전달한 요청 본문을 보내며, PlayFab의 응답을
JSON으로 씁니다. 작업과 해당 요청 본문을 찾으려면
[API 찾기](https://docs.xbox.com/ko/tools/xbox-cli/playfab-api.md#finding-an-api)를 참조하세요.

```text theme={null}
xbox playfab api <api-path> [flags]
```

이 명령에는 PlayFab 타이틀이 필요합니다. 단, 타이틀 하나로 범위가 지정되지 않는 스튜디오 API(`/Studio/*`)는
예외입니다. [컨텍스트](https://docs.xbox.com/ko/tools/xbox-cli/commands/context.md)를 참조하세요.

명령이 무엇을 변경하는지는 경로에 따라 다릅니다. 이름이 `Get`, `List` 또는 `Search`로 시작하는 작업은 읽기만
합니다. `Delete*` 및 `Shutdown*` 작업은 터미널에서는 먼저 묻고, 그 밖의 환경에서는 `--confirm`(`--yes`,
`-y`)이 필요합니다. [안전 및 파괴적 작업](https://docs.xbox.com/ko/tools/xbox-cli/safety.md)을 참조하세요.

## 인수 및 옵션

| 인수 / 옵션 | 필수 | 설명 |
| - | - | - |
| `<api-path>` | 예 | `/<Prefix>/<Operation>` 형식의 PlayFab API 경로이며, 예를 들면 `/Admin/GetTitleData` 또는 `/Catalog/SearchItems`입니다. `/`로 시작해야 합니다. Git Bash에서는 [Windows의 Git Bash에서 실행](#running-from-git-bash-on-windows)을 참조하세요. |
| `--body <body>` | 아니요 | 인라인으로 지정한 작업의 JSON 요청 개체입니다. `--body`와 `--body-file`을 모두 전달하지 않으면 기본값은 `{}`입니다. |
| `--body-file <body-file>` | 아니요 | JSON 요청 개체를 담고 있는 파일의 경로이며, stdin에서 읽으려면 `-`를 지정합니다. |
| `--data-only` | 아니요 | PlayFab 응답의 `data` 필드만 씁니다. |
| `--output`, `-o` | 아니요 | `json`(기본값) 또는 `json-compact`. |
| `--verbose` | 아니요 | 요청 본문을 제외한 진단 정보를 stderr에 씁니다. |

`--body`와 `--body-file`은 함께 사용할 수 없습니다. CLI는 본문을 유효성 검사 없이 전달한 그대로 보냅니다.

## 예제

```bash theme={null}
xbox --playfab-title-id ABC123 playfab api /Catalog/GetCatalogConfig
xbox --playfab-title-id ABC123 playfab api /Match/ListMatchmakingQueues --data-only --output json-compact
xbox --playfab-title-id ABC123 playfab api /Catalog/SearchItems --body-file search.json
xbox --playfab-title-id ABC123 playfab api /Admin/GetTitleData --body '{"Keys":["MyKey"]}' --data-only --output json-compact
```

### stdin에서 요청 본문 읽기

```bash theme={null}
printf '%s' '{"Keys":["MyKey"]}' |
  xbox --playfab-title-id ABC123 playfab api /Admin/GetTitleData --body-file -
```

stdin은 입력 끝까지 읽은 하나의 요청 본문을 제공하며, 줄마다 요청 하나를 제공하는 것이 아닙니다.
`--body-file -`을 사용하면 stdin이 프롬프트에 응답할 수 없으므로 `Delete*` 및 `Shutdown*` 작업에는
터미널에서도 `--confirm`이 필요합니다.

## Windows의 Git Bash에서 실행

Git Bash는 다른 MSYS 셸과 마찬가지로 Windows 프로그램을 시작하기 전에 `/`로 시작하는 인수를 Windows 경로로
변환합니다. CLI는 변환된 경로를 거부하고 해결 방법을 알려 줍니다.

```console theme={null}
$ xbox playfab api /Catalog/GetCatalogConfig
The API path must start with '/', such as /Admin/GetTitleData; got 'C:/Program Files/Git/Catalog/GetCatalogConfig'.
That looks like /Catalog/GetCatalogConfig after Git Bash converted it to a Windows path. Turn the conversion off for the command, for example:
  MSYS_NO_PATHCONV=1 xbox playfab api /Catalog/GetCatalogConfig
```

명령 하나에 대해 `MSYS_NO_PATHCONV=1`을 설정합니다.

```bash theme={null}
MSYS_NO_PATHCONV=1 xbox --playfab-title-id ABC123 playfab api /Catalog/GetCatalogConfig
```

또는 세션의 나머지 부분에 대해 내보냅니다.

```bash theme={null}
export MSYS_NO_PATHCONV=1
```

변환을 끄면 Git Bash가 다른 경로도 변환하지 않으므로, `--body-file`에는 `/c/requests/search.json`이 아니라
상대 경로 또는 `C:/requests/search.json` 같은 Windows 경로를 전달하세요.

## 출력

`{code,status,data}` 봉투에 담긴 PlayFab의 응답입니다.
[응답 봉투](https://docs.xbox.com/ko/tools/xbox-cli/commands/playfab.md#response-envelope)를 참조하세요. 호출이 실패하면 명령은
오류를 stderr에 쓰고 코드 `1`로 종료됩니다.
[오류 응답](https://docs.xbox.com/ko/tools/xbox-cli/playfab-api.md#error-responses)을 참조하세요.

`playfab api`는 `--output table`을 허용하지 않습니다.


## Related topics

- [api_operation](https://docs.xbox.com/ko/services/playfab/api-references/events/Segmentation/api-operation.md)
- [API 정책](https://docs.xbox.com/ko/tools/xbox-cli/commands/playfab/api-policy.md)
- [실험 API](https://docs.xbox.com/ko/services/playfab/live-service-management/game-configuration/experiments/experimentation-apis.md)
- [Lighting API 참조 (API 콘텐츠)](https://docs.xbox.com/ko/reference/lighting/gc-reference-lighting-toc.md)
- [Input API reference](https://docs.xbox.com/ko/reference/input/gc-reference-input-toc.md)
