Users API
Description of the functionality of Users API
Last updated
Description of the functionality of Users API
Last updated
Note: The following is defined in express/routes/survey.route.js
*WIP: This actually hasn't been defined yet, the code does not exist as of 0.0.6a
Private
qmd: ng-client
<'SESSION_ID': [token] Secure Cookie>
Public
qmd: ng-client
<url>/api/:id/users
i.e. http://localhost:8080/api/SomeSurveyID/users
Method
Description
Access
GET
Respond with all user data for survey {:id}
Private
<url>/api/:id/addUser
i.e. http://localhost:8080/api/SomeSurveyID/addUser
Method
Description
Access
POST
Add new user data (corresponding to survey {:id}, respond with user_id
Public
<url>/api/ :id/user/:user_id
i.e. http://localhost:8080/api/SomeSurveyID/user/SomeUserID
Method
Description
Access
GET
Respond with user data corresponding to {:user_id} from survey {:id}
Public
POST
Update user data corresponding to {:user_id} from survey {:id}
Public*
DELETE
Remove user data corresponding to {:user_id} from survey {:id}
Private
Access through src/app/user.service.ts
import { UserService } from '../../survey.service';
import { User} from '../../Models';
...
export class ... {
constructor( ... , private userservice: UserService)
}
src/app/user.service.ts
Adds api key as a HttpHeader
addAuthHeader(api_key)
Param
Type
Description
api_key
string
API Key for authentication
Contacts Survey API through HTTP to add a new user to a survey in the database, returns response from server *WIP: Deciding input format
addUser(survey_id: string, registration_info: any)
Param
Type
Description
survey_id
string
String corresponding to the survey's id
registration_info
any
Registration Fields
return
HttpResponse<>
HttpErrorResponse
Response (200/400)
Queries Survey API through HTTP given a survey_id and user_id, if a user/survey with these ids is in the database, returns user corresponding to this id pair.
getUser(survey_id: string, user_id: string)
Param
Type
Description
survey_id
string
String corresponding to the survey's id
user_id
string
String corresponding to the user's id
return
A user object
Queries Survey API through HTTP to delete User corresponding to Survey corresponding to id, returns response from server.
deleteUser(survey_id: string, user_id: string)
Param
Type
Description
survey_id
string
String corresponding to the survey's id
user_id
string
String corresponding to the user's id
return
HttpResponse<>
HttpErrorResponse
Response (200/400)
Queries Survey API through HTTP to get an array of all Users corresponding to the Survey corresponding to survey_id, returns User Array
getAllUsers(survey_id: string) => return User[] object array
Param
Type
Description
survey_id
string
String corresponding to the survey's id
return
An array of User objects
Queries Survey API through HTTP with User data and survey ID to update the relevant User data, returns response from server.
updateUser(survey_id: string, input: any)
Param
Type
Description
survey_id
string
String corresponding to the survey's id
input
An input object (corresponding to fields of User object)
return
HttpResponse<>
HttpErrorResponse
Response (200/400)
[]
ny