# 스키마

## 개요

Panther API는 다음 스키마 작업을 지원합니다:

* 사용자 정의 스키마 생성 또는 업데이트
* 스키마 목록 조회

콘솔의 API 플레이그라운드 또는 GraphQL-over-HTTP API를 사용하여 Panther의 API를 호출할 수 있습니다. 이러한 방법에 대한 자세한 내용은 [Panther API](https://docs.panther.com/ko/panther/api/..#step-1-choose-a-method-for-invoking-the-api).

참조 [맞춤 로그](https://docs.panther.com/ko/data-onboarding/custom-log-types) Panther에서 사용자 정의 스키마에 대해 자세히 알아보려면.

### 필수 API 토큰 권한

API 호출을 시작하기 전에 API 토큰에 필요한 권한이 연결되어 있는지 확인하세요:

* **로그 소스 보기**: 모든 스키마 작업에 필요합니다.
* **로그 소스 관리(Manage Log Sources)**: 변형(mutation)인 스키마 관리 작업에 필요합니다(예:) `CreateOrUpdateSchema`).
* **사용자 정보 읽기**: 생성자(createdBy)와 같은 액터 관련 통합 필드를 검색하려는 경우 필요합니다, 예: `createdBy`.

<figure><img src="https://2400888838-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LgdiSWdyJcXPahGi9Rs-2910905616%2Fuploads%2Fgit-blob-cb06bb3f6bc6edac266896c98db3f73103f79f41%2Fimage.png?alt=media" alt="An &#x22;Integrations&#x22; header is above four checkboxes: View Cloud Security Sources, Manage Cloud Security Sources, View Log Sources, and Manage Log Sources."><figcaption></figcaption></figure>

## 일반적인 스키마 작업

#### 사용자 정의 스키마 생성

```graphql
mutation addSchema {
  createOrUpdateSchema(input:{
    description: "description"
    name:"Custom.NewSchema",
    isFieldDiscoveryEnabled: true,
    spec:"""
    필드:
     - name: foo
       type: string
    """
  }) {
    schema {
      createdAt
      description
      isArchived
      isManaged
      이름
      referenceURL
      revision
      isFieldDiscoveryEnabled
      spec
      discoveredSpec
      updatedAt
      version
    }
  }
}
```

#### 스키마 목록 조회

이 쿼리는 사용자 정의 및 Panther 관리 스키마를 포함한 모든 스키마를 나열합니다.

{% hint style="info" %}
현재 페이징은 `스키마에 대해 지원되지 않습니다`—모든 스키마는 결과의 첫 번째 페이지에 반환됩니다. 아래의 `cursor` 필드로 지정됩니다. `input` 객체는 페이징이 결국 지원될 때를 위한 자리표시자입니다.
{% endhint %}

```graphql
query ListSchemas {
  schemas(input:{cursor:""}) {
    edges {
      node {
        createdAt
        description
        isArchived
        isManaged
        이름
        referenceURL
        revision
        isFieldDiscoveryEnabled
        spec
        discoveredSpec
        updatedAt
        version
      }
    }
  }
}
```
