import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class VelugaApiClient {
public static void main(String[] args) {
String apiKey = "[YOUR_API_KEY]";
String channelId = "[YOUR_CHANNEL_ID]";
String eventId = "[OPTIONAL_EVENT_ID]";
String eventValue = "[OPTIONAL_EVENT_VALUE]";
String apiUrl = "[DOMAIN]/api/v1/session";
String jsonPayload = String.format("{\"channelId\": \"%s\", \"eventId\": \"%s\", \"eventValue\": \"%s\"}",
channelId, eventId, eventValue);
try {
URL url = new URL(apiUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("X-VELUGA-API-KEY", apiKey);
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonPayload.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Session created successfully.");
} else {
System.out.println("Failed to create session.");
}
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}
curl -X GET "https://usamsung-api.veluga.app/api/v1/session" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-G \
-d "channelId=[YOUR_CHANNEL_ID]" \
-d "eventId=[OPTIONAL_EVENT_ID]" \
-d "eventValue=[OPTIONAL_EVENT_VALUE]" \
-d "page=[PAGE_NUMBER]" \
-d "limit=[LIMIT_NUMBER]" \
-d "sort=[SORT_ORDER]"
curl -X GET "/api/v1/chat/history" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-G \
-d "sessionId=[YOUR_SESSION_ID]" \
-d "page=[PAGE_NUMBER]" \
-d "limit=[LIMIT_NUMBER]" \
-d "sort=[SORT_ORDER]"
curl -X POST "/api/v2/document/file" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-H "Content-Type: multipart/form-data" \
-F "channelId=[YOUR_CHANNEL_ID]" \
-F "file=@[PATH_TO_YOUR_FILE]"
curl -X GET "/api/v1/document/file" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-G \
-d "channelId=[YOUR_CHANNEL_ID]" \
-d "keyword=[OPTIONAL_KEYWORD]" \
-d "page=[PAGE_NUMBER]" \
-d "limit=[LIMIT_NUMBER]" \
-d "sortType=[SORT_TYPE]" \
-d "sort=[SORT_ORDER]"
curl -X GET "/api/v1/document/file/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X DELETE "/api/v2/document/file/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X POST "/api/v1/document/web-url" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-H "Content-Type: application/json" \
-d '{
"channelId": "[YOUR_CHANNEL_ID]",
"webUrl": "[URL_TO_LEARN]"
}'
curl -X POST "/api/v1/document/web-url" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-H "Content-Type: application/json" \
-d '{
"channelId": "[YOUR_CHANNEL_ID]",
"webUrl": "[URL_TO_LEARN]"
}'
curl -X GET "/api/v1/document/web-url/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X GET "/api/v1/document/web-url/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X POST "/api/v1/document/post" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-H "Content-Type: application/json" \
-d '{
"channelId": "[YOUR_CHANNEL_ID]",
"title": "[YOUR_TITLE]",
"content": "[YOUR_HTML_CONTENT]",
"board": "[YOUR_BOARD]",
"fromUrl": "[YOUR_FROM_URL]",
"attachments": [
{
"name": "string",
"fileUrl": "string"
}
],
"regDatetime": "[YOUR_REG_DATETIME]",
"metadata": {
"author": "[AUTHOR_NAME]",
"attachment": "[ATTACHMENT_FILENAME]"
},
"docFilter": {
"filter1": "[FILTER_VALUE1]",
"filter2": "[FILTER_VALUE2]"
}
}'
curl -X GET "/api/v1/document/post" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]" \
-G \
-d "channelId=[YOUR_CHANNEL_ID]" \
-d "keyword=[OPTIONAL_KEYWORD]" \
-d "boardName=[OPTIONAL_BOARD_NAME]" \
-d "page=[PAGE_NUMBER]" \
-d "limit=[LIMIT_NUMBER]" \
-d "sortType=[SORT_TYPE]" \
-d "sort=[SORT_ORDER]"
curl -X GET "/api/v1/document/post/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X DELETE "/api/v2/document/post/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X GET "/api/v1/channel" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X GET "/api/v1/channel/{id}" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X POST "/api/v1/channel"
-H "X-VELUGA-API-KEY: your_api_key_here"
-H "Content-Type: application/json"
-d '{
"name": "개발팀채널",
"description": "개발팀 채널입니다.",
"welcomeMessage": "안녕하세요. 개발팀 채널입니다.",
"temperature": "inFact",
"answerTypeIfCant": ["advice", "managerPhone"],
"answerType": ""respectful, long and detailed"",
"languages": "korean",
"isPublic": false,
"enableQuestionHint": true,
"enableFollowQuestion": true,
"shouldReturnFile": true,
"searchModel": "hybrid",
"channelTemplateId": "660f83012c068b20e130781b"
}'
curl -X GET "/api/v1/channel/{id}/usage" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"
curl -X GET "/api/v1/user/me" \
-H "X-VELUGA-API-KEY: [YOUR_API_KEY]"