LabelType API

개요

LabelType API는 Fess 의 라벨 타입을 관리하기 위한 API입니다. 검색 결과의 라벨 분류, 필터링용 라벨 타입을 조작할 수 있습니다.

기본 URL

/api/admin/labeltype

엔드포인트 목록

메서드 경로 설명
GET/PUT /settings 라벨 타입 목록 조회
GET /setting/{id} 라벨 타입 조회
POST /setting 라벨 타입 만들기
PUT /setting 라벨 타입 업데이트
DELETE /setting/{id} 라벨 타입 삭제

라벨 타입 목록 조회

요청

GET /api/admin/labeltype/settings
PUT /api/admin/labeltype/settings

파라미터

응답

{
  "response": {
    "status": 0,
    "settings": [
      {
        "id": "label_id_1",
        "name": "Documentation",
        "value": "docs",
        "includedPaths": ".*docs\\.example\\.com.*",
        "excludedPaths": "",
        "sortOrder": 0
      }
    ],
    "total": 5
  }
}

라벨 타입 조회

요청

GET /api/admin/labeltype/setting/{id}

응답

{
  "response": {
    "status": 0,
    "setting": {
      "id": "label_id_1",
      "name": "Documentation",
      "value": "docs",
      "includedPaths": ".*docs\\.example\\.com.*",
      "excludedPaths": "",
      "sortOrder": 0,
      "permissions": [],
      "virtualHost": ""
    }
  }
}

라벨 타입 만들기

요청

POST /api/admin/labeltype/setting
Content-Type: application/json

요청 본문

{
  "name": "News",
  "value": "news",
  "includedPaths": ".*news\\.example\\.com.*\n.*example\\.com/news/.*",
  "excludedPaths": ".*/(archive|old)/.*",
  "sortOrder": 1,
  "permissions": ["guest"]
}

필드 설명

응답

{
  "response": {
    "status": 0,
    "id": "new_label_id",
    "created": true
  }
}

라벨 타입 업데이트

요청

PUT /api/admin/labeltype/setting
Content-Type: application/json

요청 본문

{
  "id": "existing_label_id",
  "name": "News Articles",
  "value": "news",
  "includedPaths": ".*news\\.example\\.com.*\n.*example\\.com/(news|articles)/.*",
  "excludedPaths": ".*/(archive|old|draft)/.*",
  "sortOrder": 1,
  "permissions": ["guest"],
  "versionNo": 1
}

응답

{
  "response": {
    "status": 0,
    "id": "existing_label_id",
    "created": false
  }
}

라벨 타입 삭제

요청

DELETE /api/admin/labeltype/setting/{id}

응답

{
  "response": {
    "status": 0,
    "id": "deleted_label_id",
    "created": false
  }
}

사용 예

문서용 라벨 만들기

curl -X POST "http://localhost:8080/api/admin/labeltype/setting" \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Technical Documentation",
       "value": "tech_docs",
       "includedPaths": ".*docs\\.example\\.com.*\n.*example\\.com/documentation/.*",
       "sortOrder": 0,
       "permissions": ["guest"]
     }'

라벨을 사용한 검색

# 라벨로 필터링
curl "http://localhost:8080/json/?q=search&label=tech_docs"

참고 정보