Need Help updating profile info via API

Ok… I was finally able to figure this out. Will leave a little summary here in case someone in the future is looking for how to do this. The other answers I found on the forums were out of date.

To update the name via API:
curl -X PUT -H "Content-Type: application/json; charset=utf-8" -H "Api-Key: mykey" -H "Api-Username: username" -d '{"name": “mynewname"}' -L 'https://mysite.com/u/user12345.json'

To update the username via API:
curl -X PUT -H "Content-Type: application/json; charset=utf-8" -H "Api-Key: myapikey" -H "Api-Username: username" -d '{"new_username": "mynewusername"}' -L 'https://mysite.com/u/user12345/preferences/username.json'