개발자 가이드

API 인증

애플리케이션이 INNORIX와 통신하려면 먼저 인증해야 합니다.

로그인과 토큰

설명

계정으로 로그인해 액세스 토큰(JWT) 을 발급받고, 이후 모든 요청에 Authorization: Bearerx-workspace-id 헤더를 함께 보냅니다. 토큰이 만료되면 POST /api/auth/token/refresh(헤더 X-Refresh-Token)로 갱신하고, 명령 자동화용 장기 키가 필요하면 POST /api/auth/api-keys로 발급해 x-api-key 헤더로 사용합니다.

사용 API

목적MethodEndpoint
로그인POST/api/auth/login
토큰 갱신POST/api/auth/token/refresh
API 키 발급POST/api/auth/api-keys
현재 사용자 조회GET/api/auth/me

Request

POST /api/auth/login

json
{
  "email": "<YOUR_EMAIL>",
  "password": "<YOUR_PASSWORD>"
}

Response

json
{
  "status_code": 200,
  "message": "success",
  "data": {
    "user": {
      "email": "user@example.com",
      "userName": "User Name",
      "userId": "usr_abc123",
      "accessToken": "<ACCESS_TOKEN>",
      "refreshToken": "<REFRESH_TOKEN>"
    }
  }
}

처리 순서

  1. POST /api/auth/login으로 로그인 → data.user.accessToken 수신
  2. 이후 요청에 Authorization: Bearer <ACCESS_TOKEN>x-workspace-id 헤더 부착
  3. 토큰 만료 시 POST /api/auth/token/refresh(헤더 X-Refresh-Token)로 갱신

구현 예제

BASE_URL="https://app.innorix.com"
WORKSPACE_ID="<WORKSPACE_ID>"

ACCESS_TOKEN=$(curl -s -X POST "$BASE_URL/api/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"email":"<YOUR_EMAIL>","password":"<YOUR_PASSWORD>"}' \
  | jq -r '.data.user.accessToken')

AUTH=(-H "Authorization: Bearer $ACCESS_TOKEN" -H "x-workspace-id: $WORKSPACE_ID")

시스템 연결

파일 전송은 연결된 장비(device) 사이에서 일어납니다.

디바이스 확인과 파일 탐색

설명

장비 목록을 조회해 소스·대상 deviceId를 확인하고, 연결 상태를 점검한 뒤, 소스 장비의 경로를 탐색해 전송할 항목의 hash를 얻습니다. (에이전트 설치·등록은 완료된 상태를 전제로 하며, 설치된 에이전트가 서버에 연결되면 장비 목록에 나타납니다.)

사용 API

목적MethodEndpoint
디바이스 목록GET/api/devices
연결 상태 조회GET/api/devices/{deviceId}/connectivity
파일 검색POST/api/devices/{deviceId}/files/search
폴더 조회(비스트리밍)GET/api/devices/{deviceId}/files

Request

POST /api/devices/{deviceId}/files/search

json
{
  "path": "/data/export",
  "onlyFolder": false
}

Response

GET /api/devices

json
{
  "status_code": 200,
  "message": "success",
  "data": {
    "devices": [
      { "deviceId": "dev_a1", "name": "seoul-node-01", "os": "linux", "status": "online" },
      { "deviceId": "dev_b2", "name": "hanoi-node-02", "os": "windows", "status": "offline" }
    ],
    "total_rows": 2
  }
}

처리 순서

  1. GET /api/devices로 소스·대상 deviceId 확인
  2. GET /api/devices/{deviceId}/connectivity로 두 장비 온라인 여부 확인
  3. POST /api/devices/{deviceId}/files/search로 경로 탐색 → 항목의 hash 확보

구현 예제

# --- List devices ---
curl -s "$BASE_URL/api/devices?page=1&size=20" "${AUTH[@]}"

# --- Check connectivity ---
curl -s "$BASE_URL/api/devices/<DEVICE_ID>/connectivity" "${AUTH[@]}"

# --- Browse a device path ---
curl -s -X POST "$BASE_URL/api/devices/<DEVICE_ID>/files/search" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{"path":"C:/data/export","onlyFolder":false}'

파일 · 폴더 전송

소스 장비의 파일을 대상 장비로 보내고, 진행 중 제어·결과 확인을 수행합니다.

즉시 전송과 제어

설명

탐색 결과의 hashsourceItem을 구성해 전송을 생성하면 monitorId가 반환됩니다(응답 data.monitorId). 이 값으로 일시중지·재개·취소·실패 재시도 등 제어와 결과 확인을 수행합니다. 상태 폴링은 GET /api/transfer-history/{monitorId}?idType=monitor, 파일 단위 결과는 GET /api/transfers/{monitorId}/files?idType=monitor로 조회합니다.

사용 API

목적MethodEndpoint
전송 생성POST/api/transfers/manual
전송 제어POST/api/transfers/{monitorId}/pause · resume · cancel
실패 재시도POST/api/transfers/{monitorId}/retry
상태 조회GET/api/transfer-history/{monitorId}
전송 파일 조회GET/api/transfers/{monitorId}/files

Request

POST /api/transfers/manual

json
{
  "sourceId": "6901ae48ca578216fd739f78",
  "targetId": "690037c22d309a7bc494bc53",
  "targetPath": "/data/incoming",
  "sourceItem": [{ "hash": "a1b2c3d4", "isDir": true }]
}

Response

json
{
  "status_code": 201,
  "message": "Created",
  "data": { "monitorId": "mon_7788", "transferId": "tr_5566" }
}

처리 순서

  1. POST /api/transfers/manual 호출 → data.monitorId 수신
  2. GET /api/transfer-history/{monitorId}?idType=monitor로 상태 폴링
  3. 필요 시 POST /api/transfers/{monitorId}/pause · resume · cancel로 제어, 실패는 .../retry로 재시도

구현 예제

# --- Create a transfer ---
curl -s -X POST "$BASE_URL/api/transfers/manual" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{
    "sourceId": "6901ae48ca578216fd739f78",
    "targetId": "690037c22d309a7bc494bc53",
    "targetPath": "C:/Users/innorix/Downloads/New folder (3)",
    "sourceItem": [
      { "hash": "<FILE_HASH>", "isDir": true }
    ]
  }'

# --- Control a transfer (pause / resume / cancel) ---
curl -s -X POST "$BASE_URL/api/transfers/<MONITOR_ID>/pause"  "${AUTH[@]}"
curl -s -X POST "$BASE_URL/api/transfers/<MONITOR_ID>/resume" "${AUTH[@]}"
curl -s -X POST "$BASE_URL/api/transfers/<MONITOR_ID>/cancel" "${AUTH[@]}"

# --- Retry failed files ---
curl -s -X POST "$BASE_URL/api/transfers/<MONITOR_ID>/retry" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{
    "filesRetry": [
      { "filePath": "C:/data/export/file.txt", "isDir": false }
    ]
  }'

# --- Poll transfer result ---
curl -s "$BASE_URL/api/transfer-history/<MONITOR_ID>?idType=monitor" "${AUTH[@]}"

일정 자동화

정해진 시간에 반복 실행되는 예약 전송을 구성합니다.

반복 자동화

설명

스케줄과 전송 상세(details)를 담아 자동화를 생성하면 automationId가 반환되며, 이 값으로 일시중지·재개·수정·삭제합니다. 진행률과 상태는 GET /api/automations/{automationId}/details로 조회합니다.

사용 API

목적MethodEndpoint
자동화 생성POST/api/automations
자동화 상세GET/api/automations/{automationId}/details
자동화 일시정지POST/api/automations/{automationId}/pause
자동화 수정PATCH/api/automations/{automationId}
자동화 삭제DELETE/api/automations/{automationId}

Request

POST /api/automations

json
{
  "name": "Nightly backup",
  "transferType": "scheduled",
  "timezone": "Asia/Seoul",
  "schedules": [
    { "type": "day", "hour": "02", "minute": "00" }
  ],
  "details": [
    {
      "sourceItem": ["D:/Projects/data/exported_users.csv"],
      "targetPath": "D:/Backup/Daily_Reports",
      "senderId": "user123",
      "receiverId": "backup_sys_001",
      "step": 1
    }
  ]
}

Response

json
{
  "status_code": 200,
  "message": "success",
  "data": { "automationId": "auto_301", "status": "active" }
}

처리 순서

  1. POST /api/automations 호출 → data.automationId 수신
  2. GET /api/automations/{automationId}/details로 진행률·상태 확인
  3. POST /api/automations/{automationId}/pause로 일시정지/재개, PATCH·DELETE로 수정·삭제

구현 예제

# --- Build a schedule ---
{
  "type": "day",
  "hour": "02",
  "minute": "00",
  "timezone": "Asia/Seoul",
  "startDate": "2026-01-01T00:00:00.000Z",
  "endDate": "2026-12-31T00:00:00.000Z"
}

# --- Create an automation ---
curl -s -X POST "$BASE_URL/api/automations" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Nightly backup",
    "schedules": [
      {
        "type": "day",
        "hour": "02",
        "minute": "00",
        "timezone": "Asia/Seoul",
        "startDate": "2026-01-01T00:00:00.000Z",
        "endDate": "2026-12-31T00:00:00.000Z"
      }
    ],
    "details": [
      {
        "sourceItem": [
          "D:/Projects/data/exported_users.csv",
          "D:/Projects/data/sales_report.pdf"
        ],
        "targetPath": "D:/Backup/Daily_Reports",
        "senderId": "6901ae48ca578216fd739f78",
        "receiverId": "690037c22d309a7bc494bc53",
        "step": 1,
        "fileCount": 2,
        "folderCount": 0,
        "sizeCount": 0
      }
    ]
  }'

# --- Pause / resume an automation ---
curl -s -X POST "$BASE_URL/api/automations/<AUTOMATION_ID>/pause" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{"pause": true}'

# --- Update / delete an automation ---
curl -s -X PATCH "$BASE_URL/api/automations/<AUTOMATION_ID>" "${AUTH[@]}" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Nightly backup (updated)" }'

curl -s -X DELETE "$BASE_URL/api/automations/<AUTOMATION_ID>" "${AUTH[@]}"