WebConfig API

개요

WebConfig API는 Fess 의 Web 크롤링 설정을 관리하기 위한 API입니다. 크롤링 대상 URL, 크롤링 깊이, 제외 패턴 등의 설정을 조작할 수 있습니다.

기본 URL

/api/admin/webconfig

엔드포인트 목록

메서드 경로 설명
GET/PUT /settings Web 크롤링 설정 목록 조회
GET /setting/{id} Web 크롤링 설정 조회
POST /setting Web 크롤링 설정 만들기
PUT /setting Web 크롤링 설정 업데이트
DELETE /setting/{id} Web 크롤링 설정 삭제

Web 크롤링 설정 목록 조회

요청

GET /api/admin/webconfig/settings
PUT /api/admin/webconfig/settings

파라미터

응답

{
  "response": {
    "status": 0,
    "settings": [
      {
        "id": "webconfig_id_1",
        "name": "Example Site",
        "urls": "https://example.com/",
        "includedUrls": ".*example\\.com.*",
        "excludedUrls": ".*\\.(pdf|zip)$",
        "includedDocUrls": "",
        "excludedDocUrls": "",
        "configParameter": "",
        "depth": 3,
        "maxAccessCount": 1000,
        "userAgent": "",
        "numOfThread": 1,
        "intervalTime": 1000,
        "boost": 1.0,
        "available": true,
        "sortOrder": 0
      }
    ],
    "total": 5
  }
}

Web 크롤링 설정 조회

요청

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

응답

{
  "response": {
    "status": 0,
    "setting": {
      "id": "webconfig_id_1",
      "name": "Example Site",
      "urls": "https://example.com/",
      "includedUrls": ".*example\\.com.*",
      "excludedUrls": ".*\\.(pdf|zip)$",
      "includedDocUrls": "",
      "excludedDocUrls": "",
      "configParameter": "",
      "depth": 3,
      "maxAccessCount": 1000,
      "userAgent": "",
      "numOfThread": 1,
      "intervalTime": 1000,
      "boost": 1.0,
      "available": true,
      "sortOrder": 0,
      "permissions": ["admin"],
      "virtualHosts": [],
      "labelTypeIds": []
    }
  }
}

Web 크롤링 설정 만들기

요청

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

요청 본문

{
  "name": "Corporate Site",
  "urls": "https://www.example.com/",
  "includedUrls": ".*www\\.example\\.com.*",
  "excludedUrls": ".*\\.(pdf|zip|exe)$",
  "depth": 5,
  "maxAccessCount": 5000,
  "numOfThread": 3,
  "intervalTime": 500,
  "boost": 1.0,
  "available": true,
  "permissions": ["admin", "user"],
  "labelTypeIds": ["label_id_1"]
}

필드 설명

응답

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

Web 크롤링 설정 업데이트

요청

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

요청 본문

{
  "id": "existing_webconfig_id",
  "name": "Updated Corporate Site",
  "urls": "https://www.example.com/",
  "includedUrls": ".*www\\.example\\.com.*",
  "excludedUrls": ".*\\.(pdf|zip|exe|dmg)$",
  "depth": 10,
  "maxAccessCount": 10000,
  "numOfThread": 5,
  "intervalTime": 300,
  "boost": 1.2,
  "available": true,
  "versionNo": 1
}

응답

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

Web 크롤링 설정 삭제

요청

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

응답

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

URL 패턴 예시

includedUrls / excludedUrls

패턴 설명
.*example\\.com.* example.com을 포함하는 모든 URL
https://example\\.com/docs/.* /docs/ 하위만
.*\\.(pdf|doc|docx)$ PDF, DOC, DOCX 파일
.*\\?.* 쿼리 파라미터가 있는 URL
.*/(login|logout|admin)/.* 특정 경로를 포함하는 URL

사용 예

기업 사이트 크롤링 설정

curl -X POST "http://localhost:8080/api/admin/webconfig/setting" \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Corporate Website",
       "urls": "https://www.example.com/",
       "includedUrls": ".*www\\.example\\.com.*",
       "excludedUrls": ".*/(login|admin|api)/.*",
       "depth": 5,
       "maxAccessCount": 10000,
       "numOfThread": 3,
       "intervalTime": 500,
       "available": true,
       "permissions": ["guest"]
     }'

문서 사이트 크롤링 설정

curl -X POST "http://localhost:8080/api/admin/webconfig/setting" \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Documentation Site",
       "urls": "https://docs.example.com/",
       "includedUrls": ".*docs\\.example\\.com.*",
       "excludedUrls": "",
       "includedDocUrls": ".*\\.(html|htm)$",
       "depth": -1,
       "maxAccessCount": 50000,
       "numOfThread": 5,
       "intervalTime": 200,
       "boost": 1.5,
       "available": true,
       "labelTypeIds": ["documentation_label_id"]
     }'

참고 정보