User Profile¶
Get the user's profile¶
Assuming you have acquired a valid token, you can query the user profile API to get information about the specified user.
GET /api/account/profile Host: https://login.trackmangolf.com Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjI3NGRhMmRhZmI4OTE2NDBmZjcyN
Response:
{ "sub": "a285338d-0dcf-4170-89ac-128f4349b98e", "given_name": "John", "family_name": "Doe", "nickname": "The-Golfer", "email": "john-doe@example.com", "birthdate": "1971-08-12", "picture": "https://example.com/profile/picture?pid=xxxxxx", "updated_at": "2017-02-15T12:06:16.5751516Z", "_links": { "remove_profile_picture": { "method": "DELETE", "href": "https://xxx.cdn.example.com/some-picture" } } }
Note
The API endpoint returns information about the user identified in the Bearer token in the Authorization header.
Update the user's profile¶
You can update a user's profile by making a call to the following API endpoint:
PUT /api/account/profile Host: https://login.trackmangolf.com Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjI3NGRhMmRhZmI4OTE2NDBmZjcyN { "given_name": "Pete", "family_name": "Sampras", "nickname": "The-Pistol", "birthdate":"1971-08-12" }
Currently, these are the only properties that can be updated using the profile API. There are separate APIs to update the user's email address and profile picture
Note
To update user's e mail address and manage passwords please refer to the section User account management
Upload the user's picture¶
You can upload a user's picture using the my_profile_picture_upload
link returned by the /api endpoint, passing the file parameter as form-data:
POST /api/account/profile/picture Host: https://login.trackmangolf.com Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjI3NGRhMmRhZmI4OTE2NDBmZjcyN content-type:multipart-form-data --- File: ---
{ "pictureUrl": "https://example.com/profile/picture?pid=xxxxxx" }
Remove the user's picture¶
You can remove a user's picture by using the remove_profile_picture
link returned by the /api/account/profile
endpoint. A successful response returns http status 204 No Content
:
DELETE /api/account/profile/picture Host: https://login.trackmangolf.com Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjI3NGRhMmRhZmI4OTE2NDBmZjcyN
204 No Content
Note
The remove_profile_picture
link is returned only if the user actually does have a picture uploaded.