# API経由でのプロフィール情報更新ヘルプ

**URL:** <https://meta.discourse.org/t/need-help-updating-profile-info-via-api/306686>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [2024 年 5 月 3 日午後 9:03 UTC](https://meta.discourse.org/t/need-help-updating-profile-info-via-api/306686 "2024-05-03T21:03:55Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Earnie\_Baird](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/earnie_baird/32/380079_2.png) [@Earnie\_Baird](https://meta.discourse.org/u/Earnie_Baird)\
**Post date:** [2024 年 5 月 3 日午後 9:03 UTC](https://meta.discourse.org/t/need-help-updating-profile-info-via-api/306686/1 "2024-05-03T21:03:55Z")

</div>

API を使用してユーザー情報を更新するフォーラムの例をいくつか見つけましたが、機能しません。私はジュニア開発者なので、何か明白なことを見落としているのかもしれません。

まず、この例を機能させようとしました。  
`curl -X PUT -d 'name=new name’ -L 'https://mysite.com/users/user12345.json?api_key=mykey\u0026api_username=username'`

しかし、["BAD CSRF"] が返されるため、次を試しました。

```plaintext
curl -X PUT \
  -H "Content-Type: multipart/form-data" \
  -H "Api-Key: mykey" \
  -H "Api-Username: username" \
  -d '{"name”: “new name"}' \
  -L 'https://mysite.com/users/user12345.json'

```

これは「success」：「OK」、続いてユーザーのすべての JSON が返されますが、実際には何も更新されません。

何か見落としていますか？

関連する質問ですが、同じアプローチでユーザー名を更新することはできますか？

ご協力ありがとうございます。

---

_[View the full topic](https://meta.discourse.org/t/need-help-updating-profile-info-via-api/306686)._
