コンテンツへスキップ
Rulebooks

rulebookのCSV取り込みをpreview

POST/api/v1alpha1/rulebooks/csv-imports/preview

ruleを記載したCSVを読み取り、取り込まれる内容を返します。この呼び出しでは何も作成されません。

  • アクセス: alphaを有効にしたAPI keyとMANAGE_RULEBOOKS権限。
  • 返る内容: sessionId、検出された列のマッピング、列ごとの統計、警告、作成予定のrulebook。
  • 期限: previewはexpiresAtを過ぎると使えなくなります。

マッピングと警告を確認し、sessionIdをPOST /api/v1alpha1/rulebooks/csv-importsに渡すとrulebookが作成されます。

認証

apiKey
認証Bearer <token>

場所: header

リクエストボディ

application/json

TypeScript 型定義

TypeScript では request body 型を使用します。

レスポンスボディ

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/api/v1alpha1/rulebooks/csv-imports/preview" \  -H "Authorization: Bearer $DEEPFRAME_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "csv_text": "Rule ID,Requirement\\nR1,Exit is clear",    "default_rulebook_name": "Imported Safety Rules",    "filename": "warehouse-rules.csv",    "mapping": {      "additional_description_columns": [        "Notes"      ],      "rule_description": "Details",      "rule_id": "Rule ID",      "rule_title": "Requirement",      "rulebook_name": "Section"    }  }'
{  "column_stats": [    {      "name": "Requirement",      "non_empty_count": 10,      "samples": [        "Exit is clear."      ],      "unique_count": 8    }  ],  "expires_at": "2026-08-10T11:05:00.000Z",  "filename": "warehouse-rules.csv",  "mapping": {    "additional_description_columns": [],    "rule_description": "Details",    "rule_id": "Rule ID",    "rule_title": "Requirement",    "rulebook_name": "Section"  },  "mapping_confidence": 0.95,  "mapping_source": "heuristic",  "row_count": 10,  "rulebook_count": 2,  "rulebooks": [    {      "name": "Warehouse Safety",      "rule_count": 10,      "rules": [        {          "description": "The exit remains unobstructed.",          "id": "R1",          "source_row_number": 2,          "title": "Emergency exit is clear."        }      ]    }  ],  "session_id": "rbi_0190b5d4-7e1f-7a2b-9c3d-1234567890ab",  "skipped_row_count": 1,  "total_rule_count": 10,  "warnings": []}