API v1 Documentation
Goals
- Establish which API endpoints will need to be created
Questions
- Should menu items be controlled by back end or front end?
- How to handle email confirmation
- How to handle nomination approval / rejection
Not Doing
Models
This table explains the structure of records to be returned by documented endpoints below
# | Title | Children | Notes |
---|---|---|---|
1 | User | ||
2 | Household |
|
API Documentation
Household
Method | URI | Description | Permissions | Query / Params | Return Values | Notes |
---|---|---|---|---|---|---|
GET | /households | admin - View all nominator - View own | year page (optional) | Array of households | ||
GET | /households/:id | admin - View all nominator - View own | Household | |||
POST | /households | admin - No limit nominator - Can only create as many households as their profile limit allows | Household object | |||
PUT | /households/:id | admin - Update any nominator - Update own | Household object | |||
PUT | /households/:id/feedback | admin | approved - true / false reason message (optional) | Message is not stored; it's sent to the nominator if provided. | ||
POST | /households/:id/attachment | admin - Any household nominator - Own household | file | file_path attachment_id |
Affiliation
Method | URI | Description | Permissions | Query / Params | Return Values |
---|---|---|---|---|---|
GET | /affiliations | guest | type (optional) - cfc / cmpd / cms | Array of affiliations | |
GET | /affiliations/:id | admin | Affiliation record with nested list of users that are part of the affiliation |
User
Method | URI | Description | Permissions | Query / Params | Return Values |
---|---|---|---|---|---|
GET | /users | admin | page (optional) status (required) - active / pending / disabled | Array of users | |
PUT | /users/pending/:id | admin | approved - true / false | ||
GET | /users/:id | admin - All other - Self only | User | ||
POST | /users | admin | first_name last_name affiliation_id rank phone password nomination_limit | ||
PUT | /users/:id | admin - All Other - Self only | first_name last_name affiliation_id rank phone password password_confirm nomination_limit (Only admins can set this) |
Auth
Method | URI | Description | Permissions | Query / Params | Return Values | Notes |
---|---|---|---|---|---|---|
POST | /auth/login | guest only | password | token token_expiration | ||
POST | /auth/register | guest only | first_name last_name affiliation_id rank (optional) phone password password_confirm | |||
POST | /auth/verify_email | guest only | token | |||
POST | /auth/password_reset_token | guest only | Do not inform user if matching email was found. | |||
POST | /auth/password_reset | guest only | reset_token password password_confirm |