KB Management API User Guide
This document provides a guide on how to use the API to manage the Knowledge Base (KB) system from external scripts (such as
giipAgentWin).
1. Overview
By calling the KB API (
giipKb), you can store and retrieve troubleshooting know-how, configuration information, etc., for a specific server (lssn) or database (mdb_id).
2. Basic Information
- Endpoint:
https://giipfaw.azurewebsites.net/api/giipKb - Authentication: Session tokens (AK/SK) must be passed through the
header.x-api-key
3. Function Introduction (Endpoints)
3.1 KB Registration (POST)
Registers a new knowledge document.
Payload (JSON):
{ "csn": 100, "refType": "LSSN", "lssn": 1234, "title": "Server Kernel Tuning Guide", "content": "# Guide\nHow to modify kernel parameters...", "tags": "kernel,tuning,linux" }
: Choose fromrefType
(Server),LSSN
(DB), orMDB
.GENERAL
3.2 KB Update (PUT)
Modifies an existing knowledge document.
Payload (JSON):
{ "kbSn": 42, "title": "Updated Title", "content": "Updated content...", "tags": "linux,updated" }
3.3 KB Inquiry (GET)
Retrieves a list of KB documents or detailed information that matches the filter conditions.
Query Parameters:
: Use when inquiring about a specific document.kbSn
: Inquire about knowledge related to a specific server.lssn
: Inquire about knowledge related to a specific DB.mdb_id
: Search keyword.searchKeyword
3.4 KB Deletion (DELETE)
Deletes a knowledge document.
Query Parameters:
: Number of the document to be deleted.kbSn
4. How to Use SK-based APIs (Recommended for giipAgent)
For persistent programs like
giipAgent or automation scripts, it is recommended to use a Secret Key (SK) that does not have a session expiration. SK-based calls are performed through the integrated API endpoint (giipApiSk3).
- Endpoint:
https://giipfaw.azurewebsites.net/api/giipApiSk3 - Method:
(form-urlencoded)POST
4.1 Key Parameters
: Your issued Secret Key.sk
: The command to execute (one oftext
,KbCreate
,KbUpdate
,KbDelete
,KbGet
).KbList
: Detailed data to be passed to the API (JSON string).jsondata
4.2 Call Example (PowerShell)
$sk = "YOUR_SECRET_KEY" $url = "https://giipfaw.azurewebsites.net/api/giipApiSk3" # KB Registration Example $body = @{ sk = $sk text = "KbCreate jsondata" jsondata = (@{ csn = 100 refType = "LSSN" lssn = 1234 title = "Knowledge Automatically Registered by Agent" content = "This content has been automatically analyzed from the agent." tags = "agent,auto" } | ConvertTo-Json -Compress) } $response = Invoke-RestMethod -Uri $url -Method Post -Body $body Write-Host "KB Registered. kbSn: $($response.data[0].kbSn)"
5. giipAgentWin
Automation Example (AK-based)
giipAgentWinThis is an example of automatically registering completed task logs as KBs in the
giipAgentWin script (when the login session is valid).
$ak = "YOUR_SESSION_AK" $url = "https://giipfaw.azurewebsites.net/api/giipKb" $body = @{ title = "Automation Analysis Result - $(Get-Date -Format 'yyyyMMdd')" content = "# Analysis Result`nEnvironment check has been completed." refType = "LSSN" lssn = 1201 csn = 0 tags = "auto,diag" } | ConvertTo-Json -Compress $headers = @{ "x-api-key" = $ak "Content-Type" = "application/json" } $response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body Write-Host "KB Registered. kbSn: $($response.kbSn)"
[!TIP] You can immediately check the content registered through this API on the server/DB detail page of the
frontend.giipv3