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, MES #, 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 theprivate
param.
{ "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": "Domain of Pending Doom", "code": "ME-008", "type": "Domain" }, "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, MES #, or “me” for the current user. -
token
- Required. Parameter or cookie of user token. Needsuser_update
role 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/{domain}
Moves a user to a given domain.
Params
-
{id}
- Required. Can be the numeric ID, MES #, or “me” for the current user. -
{domain}
- Required. Numeric ID of the target domain. -
token
- Required. Parameter or cookie of user token. Needsuser_assign
role over user or domain, or be updating self if not in a domain 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: 'Domain not found' }
-
Trying to assign to non-domain.
Code: 500
Content:{ status: 500, message: 'Assigning to non-domain' }
-
User is already a member of the domain.
Code: 500
Content:{ status: 500, message: 'User already member of domain' }
-
If a user is assigning themselves, they can’t leave a domain.
Code: 403
Content:{ status: 403, message: 'Cannot leave domain' }
-
If a user is assigning themselves, they can’t be assigned outside their region.
Code: 403
Content:{ status: 403, message: 'Domain not under current region' }
PUT /v1/user/{id}/suspend
Suspends a user, or restores a suspended user.
Params
-
{id}
- Required. Can be the numeric ID, MES #, or “me” for the current user. -
token
- Required. Parameter or cookie of user token. Needsuser_suspend
role 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, MES #, or “me” for the current user.
Responses
-
Code: 200
Content: Details of user. -
Code: 404
Content:{ status: 404, message: 'User not found' }