Users
Get a user
GET /api/v1/user/:username
Get publicly available information about a user
Depending on the user’s privacy settings, some user information may not be present.
Parameters
Path
username string | The handle for the Trek user account |
Response Codes
Status code | Description |
---|---|
200 | OK |
404 | Not found |
Code samples for "Get a user"
GET /api/v1/user/:username
curl -L \
http://localhost:3000/api/v1/user/gregork
- Private profile response
- Public profile response
- Response schema
status: 200
{
"name": "Gregor Kiczales",
"username": "gregork",
"image": "http://localhost:3000/api/v1/user/gregork/picture"
}
status: 200
{
"name": "Gregor Kiczales",
"username": "gregork",
"image": "http://localhost:3000/api/v1/user/gregork/picture",
"description": "Father of all CS students, king of the natural recursion, and the master of the AOP.",
"links": [
{
"type": "twitter",
"url": "https://twitter.com/gregork"
},
{
"type": "site",
"url": "https://cs.ubc.ca/~gregor"
}
],
"interests": ["Island", "Ocean", "Hiking", "Nature", "Recursion"]
}
{
"name": "string",
"username": "string",
"image": "string",
"description?": "string",
"links?": "Array<{type: string, url: string}">,
"interests?": "Array<string>",
}
Get a user's profile picture
GET /api/v1/user/:username/picture
Get the profile picture of the given username
Parameters
Header
Max-Width number | maximum width of the image to return (required?) |
Max-Height number | maximum height of the image to return (required?) |
Path
username string | The handle for the Trek user account |
Response Codes
Status code | Description |
---|---|
200 | OK |
404 | Not found |
Code samples for "Get a user's profile picture"
GET /api/v1/user/:username/picture
curl -L \
-H "Max-Width: 400" \
-H "Max-Height: 400" \
http://localhost:3000/api/v1/user/gregork/picture
Get the authenticated user
GET /api/v1/user
Get profile information about the currently authenticated user.
Parameters
Header
token string | The user access token |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
Code samples for "Get the authenticated user"
GET /api/v1/user
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/user
- Example response
- Response schema
status: 200
{
"userId": "ksjhfoi-i32aiufh-192oh"
"name": "Gregor Kiczales",
"username": "gregork",
"image": "http://localhost:3000/api/v1/user/gregork/picture",
"description": "Father of all CS students, king of the natural recursion, and the master of the AOP.",
"links": [
{
"type": "twitter",
"url": "https://twitter.com/gregork"
},
{
"type": "site",
"url": "https://cs.ubc.ca/~gregor"
}
],
"interests": ["Island", "Ocean", "Hiking", "Nature", "Recursion"]
}
{
"userId": "string",
"name": "string",
"username": "string",
"image": "string",
"description": "string",
"links": "Array<{type: string, url: string}">,
"interests": "Array<string>",
}
Get authenticated user settings
GET /api/v1/user/settings
Get all the settings for the currently authenticated user
Parameters
Header
token string | The user access token |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
Code samples for "Get authenticated user settings"
GET /api/v1/user/settings
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/user/settings
- Example response
- Response schema
status: 200
{
"accountLimitedDeals": "false",
"accountNewsletterNotifications": "false",
}
{
"accountLimitedDeals": "boolean",
"accountNewsletterNotifications": "boolean",
}
Get authenticated user's experience settings
GET /api/v1/user/experience
Get all the experience settings for the currently authenticated user
Parameters
Header
token string | The user access token |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
Code samples for "Get authenticated user settings"
GET /api/v1/user/settings
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/user/settings
- Example response
- Response schema
status: 200
{
"accountLimitedDeals": "false",
"accountNewsletterNotifications": "false",
}
{
"accountLimitedDeals": "boolean",
"accountNewsletterNotifications": "boolean",
}
Create a new user
POST /api/v1/user
Creates a new user
Parameters
Body
name string | The new user's name |
username string | The new user's username |
Response Codes
Status code | Description |
---|---|
200 | OK |
403 | Forbidden (Username taken) |
Code samples for "Create a new user"
POST /api/v1/user
curl -L \
-X POST \
http://localhost:3000/api/v1/user/gregork/settings \
-d '{"name": "Ron Garcia", "username": "rxg"}'
- Example response
- Response schema
status: 200
{
"userId": "a87sdhf-9h3iuhfsd-i923hie"
"name": "Ron Garcia",
"username": "rxg",
"image": "http://localhost:3000/api/v1/user/default/picture",
"description": "",
"links": [],
"interests": []
}
{
"userId": "string",
"name": "string",
"username": "string",
"image": "string",
"description": "string",
"links": "Array<{type: string, url: string}">,
"interests": "Array<string>",
}
Update a user's settings
PUT /api/v1/user/:username/settings
Update the settings of a user with specified username
Parameters
Header
token string | The user access token |