인증서 삭제
인증서 삭제 (DELETE)
특정 인증서를 삭제합니다.
-
Method:
DELETE
-
URL:
/achievements/{achievementId}
-
URL Parameter:
achievementId
(number, 필수): 삭제할 인증서 ID
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.delete(url)
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Authorization", "Bearer " + apiKey)
.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)
.delete(RequestBody.create(new byte[0]))
.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
.delete(url, {
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("DELETE", url);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Authorization", "Bearer " + apiKey);
xhr.send();
const fetch = require("node-fetch");
const url = `https://api.test.kolleges.net/open-api/achievements/${achievementId}`;
fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
},
})
.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 options = {
method: "DELETE",
hostname: "api.test.kolleges.net",
path: `/open-api/achievements/${achievementId}`,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${apiKey}`,
},
};
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.end();
- Requests
import requests
url = f"https://${baseURL}/open-api/achievements/{achievement_id}"
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {api_key}"
}
response = requests.delete(url, headers=headers)
print("Status:", response.status_code)
try:
print("Response:", response.json())
except Exception as e:
print("Response:", response.text)
- cURL
curl -X DELETE "https://${baseURL}/open-api/achievements/${achievementId}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $API_KEY"