User
Allows accessing and manipulating users.
GET /v1/user
Provides a list of users, with optional filtering.
Params
- 
    
token- Required. Parameter or cookie of user token. - 
    
name- Search of names. - 
    
email- Search by email. Exact search only. - 
    
mes- Search by membership number. Exact search only. - 
    
type- Search by membership type, full, trial, or suspended. Exact search only. - 
    
orgUnit- Show members only under a specific org unit ID and it’s descendants. - 
    
expired- Shows expired members or not. Defaults to true. - 
    
limit- Integer. Number of results to return, defaults to 100. - 
    
offset- Integer. Offset for results, defaults to 0. 
Responses
- Code: 200
Content: Array of user objects.[ { "id": 1, "membershipNumber": "US2016010001", "firstName": "Test", "lastName": "Admin", "nickname": null, "fullName": "Test Admin", "membershipType": "Full", "membershipExpiration": "2020-01-01T00:00:00.000Z" } ] - 
    
Org unit specified doesn’t exist.
Code: 404
Content:{ status: 404, message: 'Org unit not found' } - Other errors.
Code: 500
Content:{ status: 400, message: 'List failed' } 
GET /v1/user/{id}
Provides details about a given user.
Params
- 
    
{id}- Required. Can be the numeric ID, WPI #, or “me” for the current user. - 
    
token- Required. Parameter or cookie of user token. - 
    
private- Query var that shows private user data if the user has permission. Defaults to false, unless “me” is selected where it’s always true. 
Responses
- Code: 200
Content: Details of the user. Email and address are hidden without theprivateparam.
{ "id": 1, "firstName": "Test", "lastName": "Admin", "nickname": null, "address": null, "email": "admin@test.com", "membershipType": "Full", "membershipNumber": "US2016010001", "membershipExpiration": "2020-01-01T00:00:00.000Z", "orgUnit": { "id": 7, "name": "Chapter of Pending Doom", "code": "ME-008", "type": "Chapter" }, "fullName": "Test Admin" } - 
    
User ID provided is invalid.
Code: 400
Content:{ status: 400, message: 'Invalid ID provided' } - Code: 404
Content:{ status: 404, message: 'User not found' } 
PUT /v1/user/{id}
Updates a user.
Params
- 
    
{id}- Required. Can be the numeric ID, WPI #, or “me” for the current user. - 
    
token- Required. Parameter or cookie of user token. Needsuser_updaterole over user, or be updating self. 
Body
- 
    
firstName: First name. - 
    
lastName: Last name. - 
    
nickname: The nickname. - 
    
address: Home address, viewable by officers only. - 
    
email: Primary contact email. - 
    
membershipType: The type of member. - 
    
membershipExpiration: The membership expiration date. 
Responses
- 
    
Code: 200
Content: Updated details of user. - 
    
User ID provided is invalid.
Code: 400
Content:{ status: 400, message: 'Invalid ID provided' } - 
    
No body data provided.
Code: 400
Content:{ status: 400, message: 'No data provided' } - 
    
Code: 404
Content:{ status: 404, message: 'User not found' } - 
    
Invalid body data provided.
Code: 400
Content:{ status: 400, message: 'Invalid data provided: [errors]' } 
PUT /v1/user/{id}/assign/{chapter}
Moves a user to a given chapter.
Params
- 
    
{id}- Required. Can be the numeric ID, WPI #, or “me” for the current user. - 
    
{chapter}- Required. Numeric ID of the target chapter. - 
    
token- Required. Parameter or cookie of user token. Needsuser_assignrole over user or chapter, or be updating self if not in a chapter already. 
Responses
- 
    
Code: 200
Content:{ success: true } - 
    
User ID provided is invalid.
Code: 400
Content:{ status: 400, message: 'Invalid ID provided' } - 
    
Code: 404
Content:{ status: 404, message: 'User not found' } - 
    
Code: 404
Content:{ status: 404, message: 'Chapter not found' } - 
    
Trying to assign to non-chapter.
Code: 500
Content:{ status: 500, message: 'Assigning to non-chapter' } - 
    
User is already a member of the chapter.
Code: 500
Content:{ status: 500, message: 'User already member of chapter' } - 
    
If a user is assigning themselves, they can’t leave a chapter.
Code: 403
Content:{ status: 403, message: 'Cannot leave chapter' } - 
    
If a user is assigning themselves, they can’t be assigned outside their region.
Code: 403
Content:{ status: 403, message: 'Chapter not under current region' } 
PUT /v1/user/{id}/approve
Approves a user’s membership.
Params
- 
    
{id}- Required. Can be the numeric ID, or WPI #. - 
    
{organization}- Required if more than one organization defined in config/organizations.json. ID of organization. - 
    
token- Required. Parameter or cookie of user token. Needsuser_approverole over user. 
Responses
- 
    
Code: 200
Content:{ success: true } - 
    
User ID provided is invalid.
Code: 400
Content:{ status: 400, message: 'Invalid ID provided' } - 
    
Code: 404
Content:{ status: 404, message: 'User not found' } 
PUT /v1/user/{id}/suspend
Suspends a user, or restores a suspended user.
Params
- 
    
{id}- Required. Can be the numeric ID, WPI #, or “me” for the current user. - 
    
token- Required. Parameter or cookie of user token. Needsuser_suspendrole over user. 
Responses
- 
    
Code: 200
Content: Updated details of user. - 
    
Code: 400
Content:{ status: 400, message: 'Invalid ID provided' } - 
    
Code: 404
Content:{ status: 404, message: 'User not found' } 
POST /v1/user/portal
Internal endpoint only. Creates or updates a user based off of the portal ID.
Responses
- 
    
Code: 200
Content: Updated details of user. - 
    
Code: 400
Content:{ status: 400, message: 'Invalid POST' } 
GET /v1/user/{id}/internal
Internal endpoint only. Gets data about user for internal use.
Params
{id}- Required. Can be the numeric ID, WPI #, or “me” for the current user.
Responses
- 
    
Code: 200
Content: Details of user. - 
    
Code: 404
Content:{ status: 404, message: 'User not found' }