[API] In the Documentation: Wrong Key in the API Suspend

AI-generated summary

Hossam_Youssef reported a bug in the Discourse API documentation where the duration key in the PUT request for suspending a user is incorrect — it results in suspended_till: null, effectively unsuspending the account. The correct key should be suspend_until. Hossam_Youssef provided a working example and suggested updating the docs. blake encouraged contributing directly to the open-source documentation repo, and Hossam_Youssef agreed, later submitting a pull request to fix the issue HYG. The fix ensures the suspension duration is properly set, avoiding unintended account unsuspension. This issue affects users relying on the documented API behavior and highlights the value of community contributions to maintain accurate documentation.

Hello,

I have found a wrong key which used in the PUT method to suspend an account which is making the suspend action not possible.

in the api documentaion:

API Request

    api_key:{{api_key}}
    api_username:{{api_username}}
    duration:2017-12-04
    reason:Reason Test Here

The expected response
Getting the account suspended:

        {
            {
            "suspension": {
                "suspended": true,
                "suspend_reason": "Reason Test Here",
                "suspended_till": "2017-12-04T00:00:00.000Z",
                "suspended_at": "2017-11-30T10:49:51.248Z"
            }
        }

The current response
Getting null value in the duration so “It suspend the account till ZERO TIME so it means UNSUPSEND”

    {
        "suspension": {
            "suspended": true,
            "suspend_reason": "Reason Test Here",
            "suspended_till": null,
            "suspended_at": "2017-11-30T10:49:51.248Z"
        }
    }

The Solution
Replace the duration key to suspend_until in the body request and it works fine! like that:

    api_key:{{api_key}}
    api_username:{{api_username}}
    suspend_until:2017-12-04
    reason:Reason Test Here

So I will appreciate if you could update this part in the API documentation. it could help others.

Thanks in advance!
Hossam

「いいね!」 4

Thank you for figuring this out and writing up a solution!

Is this something you would like to try and update yourself? The docs are open source and contributions are welcome :slight_smile:.

「いいね!」 5

Thanks Blake, I am going to open PR. :slight_smile:

「いいね!」 1

HYG, Change the duration to suspend_untill key for suspend end point with … by HossamYoussef2009 · Pull Request #9 · discourse/discourse_api_docs · GitHub :slight_smile:

「いいね!」 5