# كيفية استخدام مهمة ريك المخصصة 'undo change timestamp'؟

**URL:** <https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450>\
**Category:** Development\
**Created:** [26 مايو 2024، 9:47ص UTC](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450 "2024-05-26T09:47:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Dotila\_Li](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dotila_li/32/303426_2.png) [@Dotila\_Li](https://meta.discourse.org/u/Dotila_Li)\
**Post date:** [26 مايو 2024، 11:54ص UTC](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450/3 "2024-05-26T11:54:13Z")

</div>

شكراً لك، سأجرب ذلك لاحقاً.

لقد جربت طريقة الـ API للتو.

> **[Discourse API Docs](https://docs.discourse.org/#tag/Topics/operation/updateTopicTimestamp)**

ولكنني أحصل على خطأ 400، يقول:

```plaintext
{ errors: ['param is missing or the value is empty: timestamp'] }

```

هذا هو الكود الخاص بي:

```js
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");
  }
}

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-use-undo-change-timestamp-custom-rake-task/309450)._
