감사합니다. 나중에 시도해 보겠습니다.
방금 API 방식으로 시도해 보았습니다.
하지만 400 오류가 발생하며 다음과 같은 메시지가 표시됩니다.
{ errors: [ 'param is missing or the value is empty: timestamp' ] }
제 코드는 다음과 같습니다.
changeTimestamp(935, 1694291380);
async function changeTimestamp(topicId, timestamp) {
const endpoint = `/t/${topicId}/change-timestamp`;
const payload = {
timestamp: timestamp,
};
put(endpoint, payload);
}
async function put(endpoint, payload) {
const response = await fetch(DISCOURSE_ADDRESS + endpoint, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Api-Key": DISCOURSE_API_KEY,
"Api-Username": API_USERNAME,
body: JSON.stringify(payload),
},
});
const result = await response.json();
if (!response.ok) {
console.log("put failed");
console.log(result);
} else {
console.log("put success");
}
}