인증서 수정
인증서 수정 (PATCH)
특정 인증서 정보를 수정합니다.
-
Method:
PATCH
-
URL:
/achievements/{achievementId}
-
URL Parameter:
achievementId
(number, 필수): 수정할 인증서 ID
-
Request Body (JSON):
필드 타입 필수 설명 course_begin_at string (ISO8601) | null No 인증서와 연관된 과정(학습, 교육)등의 시작일 course_end_at string (ISO8601) | null No 인증서와 연관된 과정(학습, 교육)등의 종료일 expiration_date string (ISO8601) | null No 인증서 만료일 (null이면 영구 유효) created_at string (ISO8601) No 인증서 발급일 admin_comment string | null No 관리자가 인증서에 남긴 코멘트 level number No 인증서 레벨 -
Body 예시:
{
"course_begin_at": "2025-04-01T00:00:00Z",
"course_end_at": "2025-07-01T00:00:00Z",
"expiration_date": "2026-04-01T00:00:00Z",
"admin_comment": "재발급 요청으로 인해 수정",
"level": 2
}
Response
{
"statusCode": 200,
"message": "인증서가 수정되었습니다."
}
오류 코드
상태 코드 | 에러 | 메시지 | 상세 설명 |
---|---|---|---|
400 | BadRequest | 잘못된 요청입니다. | 허가되지 않은 값, 올바르지 않은 형식의 요청 |
401 | Unauthorized | Invalid token | 인증 정보가 올바르지 않은 경우 |
404 | AchievementNotFound | 해당 인증서를 찾을 수 없습니다. | 인증서가 존재하지 않는 경우 |
500 | InternalServerError | 예기치 않은 오류가 발생했습니다. | 서버 에러 |
Request Sample
- Java
- JavaScript
- Python
- Shell
- Unirest
- OkHttp
String url = "https://${baseURL}/open-api/achievements/" + achievementId;
HttpResponse<String> response = Unirest.patch(url)
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer " + apiKey)
.body(jsonBody)
.asString();
System.out.println("Status: " + response.getStatus());
System.out.println("Response: " + response.getBody());
OkHttpClient client = new OkHttpClient();
String url = "https://${baseURL}/open-api/achievements/" + achievementId;
Request request = new Request.Builder()
.url(url)
.patch(body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer " + apiKey)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println("Status: " + response.code());
System.out.println("Response: " + response.body().string());
} catch (Exception e) {
e.printStackTrace();
}
- Axios
- XMLHttpRequest
- Fetch
- HTTP
const axios = require("axios");
const url = `https://api.test.kolleges.net/open-api/achievements/${achievementId}`;
axios
.patch(url, body, {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
},
})
.then((response) => {
console.log("Status:", response.status);
console.log("Response:", response.data);
})
.catch((error) => {
console.error(
"Error:",
error.response ? error.response.data : error.message
);
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
const url = `https://api.test.kolleges.net/open-api/achievements/${achievementId}`;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log("Response:", this.responseText);
}
});
xhr.open("PATCH", url);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Authorization", "Bearer " + apiKey);
xhr.send(JSON.stringify(data));
const fetch = require("node-fetch");
const url = `https://api.test.kolleges.net/open-api/achievements/${achievementId}`;
fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify(body),
})
.then((response) => {
console.log("Status:", response.status);
return response.text();
})
.then((data) => {
console.log("Response:", data);
})
.catch((error) => console.error("Error:", error));
const https = require("https");
const postData = JSON.stringify({
achievementFormId: 482,
mode: "email",
users: [
{
name: "홍길동",
email: "hong@example.com",
admin_comment: "축하합니다!",
level: 5,
custom_attributes: [{ attribute_tag: "score", attribute_value: "90" }],
},
],
});
const options = {
method: "PATCH",
hostname: "api.test.kolleges.net",
path: `/open-api/achievements/${achievementId}`,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
"Content-Length": Buffer.byteLength(postData),
},
};
const req = https.request(options, (res) => {
const chunks = [];
res.on("data", (chunk) => {
chunks.push(chunk);
});
res.on("end", () => {
const body = Buffer.concat(chunks).toString();
console.log("Status:", res.statusCode);
console.log("Response:", body);
});
});
req.on("error", (error) => {
console.error("Error:", error);
});
req.write(postData);
req.end();
- Requests
import requests
import json
url = f"https://${baseURL}/open-api/achievements/{achievement_id}"
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {api_key}"
}
response = requests.patch(url, headers=headers, data=json.dumps(payload))
print("Status:", response.status_code)
try:
print("Response:", response.json())
except Exception as e:
print("Response:", response.text)
- cURL
curl -X PATCH "https://${baseURL}/open-api/achievements/${achievementId}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"course_begin_at": "2025-04-01",
"course_end_at": "2025-07-01",
"admin_comment": "cURL patch test",
"level": 2
}'