# 匿名化用户：尝试时 API 返回空白响应？

**URL:** https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144
**Category:** Development
**Created:** [2018 年1 月 27 日 08:46 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144 "2018-01-27T08:46:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Frank\_Bailey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frank_bailey/32/83927_2.png) [@Frank\_Bailey](https://meta.discourse.org/u/Frank_Bailey)
#### Post date: [2018 年1 月 27 日 08:46 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/1 "2018-01-27T08:46:47Z")

</div>

Hi folks, I’m trying to hit the endpoint to anonymize a user in Discourse; I’ve got single sign-on between WordPress and Discourse set up, and when the user deletes their account on WordPress I want to anonymize them in Discourse. The endpoint is

```plaintext
/admin/users/{id}/anonymize:
put:
  description: |
    Anonymize a user
  tags:
    - Admin
  parameters:
    - name: id
      in: path
      required: true
      type: integer
  responses:
    '200':
      description: succesfully anonymized user
      schema:
        type: object
        properties:
          success:
            type: string
          username:
type: "string"

```

When I hit that endpoint with a PUT and a valid user ID, API key and username etc., I get no response. Blank page. I’m guessing I should definitely get some kind of response, so has this endpoint perhaps been removed or renamed in some way?

---

<div class="post-metadata">

### Author: ![Frank\_Bailey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frank_bailey/32/83927_2.png) [@Frank\_Bailey](https://meta.discourse.org/u/Frank_Bailey)
#### Post date: [2018 年1 月 29 日 11:44 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/2 "2018-01-29T11:44:56Z")

</div>

Nobody has any idea on this one?

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2018 年1 月 29 日 14:19 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/3 "2018-01-29T14:19:07Z")

</div>

No, the endpoint is not removed or renamed, and yes you should get the username back in json:

> <https://github.com/discourse/discourse/blob/main/app/controllers/admin/users_controller.rb#L453-L460>

What HTTP response code are you getting?

---

<div class="post-metadata">

### Author: ![Frank\_Bailey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frank_bailey/32/83927_2.png) [@Frank\_Bailey](https://meta.discourse.org/u/Frank_Bailey)
#### Post date: [2018 年1 月 29 日 14:44 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/4 "2018-01-29T14:44:26Z")

</div>

Hi Michael. I’m an idiot. I was trying to hit http:// when the forum is set to https://

IDIOT IDIOT IDIOT

Thanks for trying to help.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年1 月 29 日 23:42 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/5 "2018-01-29T23:42:29Z")

</div>

> [@Frank\_Bailey](#):
>
> IDIOT IDIOT IDIOT

Don’t feel that bad about it, we all make mitsakes sometimes.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [2018 年1 月 30 日 23:00 UTC](https://meta.discourse.org/t/anonymize-user-blank-response-from-api-on-attempt/79144/6 "2018-01-30T23:00:04Z")

</div>

This topic was automatically closed after 32 hours. New replies are no longer allowed.
