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

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:
http://docs.discourse.org/#tag/Admin%2Fpaths%2F~1admin~1users~1{id}~1suspend%2Fput

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 Likes

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 Likes

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

1 Like

HYG, https://github.com/discourse/discourse_api_docs/pull/9/files :slight_smile:

5 Likes