# 데이터 모델

## 개요

이러한 API 작업을 사용하여 상호 작용합니다 [데이터 모델](https://docs.panther.com/ko/detections/rules/python/data-models) Panther에서.

API를 호출하려면, 다음을 참조하세요 [Panther REST API 사용 방법](https://docs.panther.com/ko/panther/api/rest/..#how-to-use-the-panther-rest-api) 지침—포함하여 [이 문서 페이지에서 직접 호출하는 방법에 대한 안내](https://docs.panther.com/ko/panther/api/rest/..#step-3-invoke-the-panther-rest-api).

## 필수 권한

* 에 대해 `GET` 작업의 경우, 귀하의 API 토큰은 다음을 가져야 합니다 `로그 소스 보기` 권한.
* 에 대해 `POST`, `PUT`, 그리고 `DELETE` 작업의 경우, 귀하의 API 토큰은 다음을 가져야 합니다 `로그 소스 관리` 권한.

## 작업

## POST /data-models

> create data model

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"data model","description":"The data model api handles all operations for data models"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"DataModelAPI.ModifyDataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}},"required":["id"]},"DataModelAPI.DataModelMapping":{"type":"object","properties":{"method":{"type":"string","description":"the python function name that should be called"},"name":{"type":"string","description":"the name of the mapping"},"path":{"type":"string","description":"the json path"}},"required":["name"]},"DataModelAPI.DataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"lastModified":{"type":"string"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}}},"DataModelAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"DataModelAPI.ExistsError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/data-models":{"post":{"tags":["data model"],"summary":"create data model","operationId":"data model#create","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.ModifyDataModel"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.DataModel"}}}},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.BadRequestError"}}}},"409":{"description":"exists: Conflict response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.ExistsError"}}}}}}}}}
```

## GET /data-models/{id}

> get data model

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"data model","description":"The data model api handles all operations for data models"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"DataModelAPI.DataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"lastModified":{"type":"string"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}}},"DataModelAPI.DataModelMapping":{"type":"object","properties":{"method":{"type":"string","description":"the python function name that should be called"},"name":{"type":"string","description":"the name of the mapping"},"path":{"type":"string","description":"the json path"}},"required":["name"]},"DataModelAPI.NotFoundError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/data-models/{id}":{"get":{"tags":["data model"],"summary":"get data model","operationId":"data model#get","parameters":[{"name":"id","in":"path","description":"ID of the data model to fetch","required":true,"schema":{"type":"string","description":"ID of the data model to fetch"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.DataModel"}}}},"404":{"description":"not_found: Not Found response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.NotFoundError"}}}}}}}}}
```

## put data model

> put creates or updates a data model

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"data model","description":"The data model api handles all operations for data models"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"DataModelAPI.ModifyDataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}},"required":["id"]},"DataModelAPI.DataModelMapping":{"type":"object","properties":{"method":{"type":"string","description":"the python function name that should be called"},"name":{"type":"string","description":"the name of the mapping"},"path":{"type":"string","description":"the json path"}},"required":["name"]},"DataModelAPI.DataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"lastModified":{"type":"string"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}}},"DataModelAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/data-models/{id}":{"put":{"tags":["data model"],"summary":"put data model","description":"put creates or updates a data model","operationId":"data model#put","parameters":[{"name":"id","in":"path","description":"the id of the data model","required":true,"schema":{"type":"string","description":"the id of the data model"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.ModifyDataModel"}}}},"responses":{"200":{"description":"200 returned if the item already existed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.DataModel"}}}},"201":{"description":"201 returned if the item was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.DataModel"}}}},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.BadRequestError"}}}}}}}}}
```

## DELETE /data-models/{id}

> delete data model

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"data model","description":"The data model api handles all operations for data models"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"DataModelAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"DataModelAPI.NotFoundError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/data-models/{id}":{"delete":{"tags":["data model"],"summary":"delete data model","operationId":"data model#delete","parameters":[{"name":"id","in":"path","description":"ID of the data model to delete","required":true,"schema":{"type":"string","description":"ID of the data model to delete"}}],"responses":{"204":{"description":"No Content response."},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.BadRequestError"}}}},"404":{"description":"not_found: Not Found response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.NotFoundError"}}}}}}}}}
```

## GET /data-models

> list data models

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"data model","description":"The data model api handles all operations for data models"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"DataModelAPI.ListResp":{"type":"object","properties":{"next":{"type":"string","description":"pagination token for the next page of results"},"results":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModel"}}}},"DataModelAPI.DataModel":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the data model"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the data model"},"displayName":{"type":"string","description":"The name used for the data model"},"enabled":{"type":"boolean","description":"enables/disables a data model"},"id":{"type":"string","description":"The id of the data model"},"lastModified":{"type":"string"},"logTypes":{"type":"array","items":{"type":"string"},"description":"The log type this data model should associate to. NOTE: only one data model can be assigned to a log type"},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/DataModelAPI.DataModelMapping"}}}},"DataModelAPI.DataModelMapping":{"type":"object","properties":{"method":{"type":"string","description":"the python function name that should be called"},"name":{"type":"string","description":"the name of the mapping"},"path":{"type":"string","description":"the json path"}},"required":["name"]}}},"paths":{"/data-models":{"get":{"tags":["data model"],"summary":"list data models","operationId":"data model#list","parameters":[{"name":"cursor","in":"query","description":"the pagination token","allowEmptyValue":true,"schema":{"type":"string","description":"the pagination token"}},{"name":"limit","in":"query","description":"the maximum results to return","allowEmptyValue":true,"schema":{"type":"integer","description":"the maximum results to return","default":100,"format":"int64"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataModelAPI.ListResp"}}}}}}}}}
```
