Skip to content
SNM-I

API

These are the internal APIs between the frontend and backend (see project architecture). All API routes below are prepended with /api/. This means that when you call the API login/securityQuestions/fetch from the frontend, for example, you should actually call /api/login/securityQuestions/fetch.

base

This section is for the User section of the requirements. Particularly the ability to log in and out of the application.

RouteMethodParametersActionReturn
loginPOSTemail
password
Check the password and email and set the backend to logged in stateuser account info
login/securityQuestions/fetchGETuser iduser’s primary email and security questions
login/securityQuestions/checkPOSTprimary email
security question
answer
Check if the answer is correctsuccess
logoutPOSTLogs out of the session

register

This section is for the User section of the requirements. Particularly the ability to register with the application.

RouteMethodParametersAction
register/invitePOSTemail
superuser flag
expiration date
Create a temporary user and sends an email with the invitation link
register/firstEntry/verifyPOSTjwt token (sent with the invitation email)Check if the token was sent within 24 hours and not used already
register/firstEntry/updatePUTemail
password
security questions
Update the user with the provided info and set the user from temporary to permanent

user

This section is for the User section of the requirements. Particularly the ability to edit profile information, and to reset or edit the password.

RouteMethodParametersAction
user/profile/getCurrentUserProfile/:idGETemailReturn all info of the user
user/editProfile/:idPOSTemailUpdate user info according to the arguments (except for the primary email)
user/updateUserForm/:idPOSTemailUpdate user info according to the non-empty arguments
user/editProfile/updatePrimaryEmail/:idPOSTuser id
new email
Send a confirmation link to the new email
user/resetPassword/checkCurrentPassword/:idPOSTuser id
password
Check if the password matches the current one
user/resetPassword/saveNewPassword/:idPOSTuser id
password
email (optional)
Save the password to the account with the email or the current logged in user if no email given
user/updatePrimaryEmailPOSTjwt token (from the change primary email confirmation link)Update primary email if the token is valid
user/:idDELETEuser idDelete the user (must be another user)

forgotPassword

This section is for the User section of the requirements. Particularly the ability to reset the password.

RouteMethod
forgotPassword/securityQuestions/fetchPUT
forgotPassword/securityQuestions/checkPOST
forgotPassword/sendVerificationEmailPOST
forgotPassword/resetPassword/verifyPOST
forgotPassword/resetPassword/saveNewPasswordPOST

users

This section is for the Admin section of the requirements. Particularly the ability to browse all user profiles.

RouteMethodAction
usersGETReturn all user profiles
users/getUserProfileById/:id/GETReturn the user profile of the specified user id

characteristic

This section is for the Admin section of the requirements. Particularly the ability to create/edit/delete characteristics.

RouteMethod
characteristic/fieldTypesGET
characteristic/dataTypesGET
characteristic/optionsFromClassGET
characteristics/detailsGET
characteristic/:idGET
characteristicsGET
characteristicPOST
characteristic/:idPUT
characteristic/delete/:idDELETE

dynamicForm

This section is for the Admin section of the requirements. Particularly the ability to manage forms and form items.

RouteMethodAction
dynamicFormPOSTCreate a form
dynamicFormGETGet all forms
dynamicForm/:idPUTUpdate a form
dynamicForm/:idGETGet a form
dynamicForm/:idDELETEDelete a form
dynamicForm/:formTypeGETGet a set of forms by form type
dynamicClassInstances/:classGET
label/:uriGETGet the label of a URI

question

This section is for the Admin section of the requirements. Particularly the ability to create/edit/delete questions.

RouteMethod
question/:idGET
questionsGET
questionPOST
question/:idPUT
question/delete/:idDELETE

genericData

RouteMethod
generics/:genericTypeGET
generic/:genericType/:idGET
generic/:genericTypePOST
generic/:genericType/:idPUT
generic/:genericType/:idDELETE

The genericType GET routes are used for getting all the generic items of a certain type. If we pass another parameter, searchitem, we can search for a specific string.

RouteMethod
genericSearch/:genericType?searchitem=itemGET

Example /api/generics/program?searchitem=AAA can be used to search program that contains ‘AAA’ or program that have a attribute that contains ‘AAA’.

The query are down below. It uses FTS GraphDB searching function and Lucene Connector searching function. We use both of them in case one of them misses some data.

The current design support limited ability of blurring search.
eg. searching for “B” will contain “Ben”.

advancedSearch

RouteMethod
advancedSearch/fetchForAdvancedSearch/:genericType/:genericItemTypeGET
advancedSearch/:genericType/:genericItemTypePUT
advancedSearch/servicePOST

service

The advanced search over service is the first advanced search function completed. The advanced search function for different types are not completed yet, therefore service searching will be independent from other types so far.

The advanced search function for service required POST calls with a JSON format body sent to the backend. With the attributed include “Name” and “Eligibility Condition” (So far).

The JSON format is as below:

{
    "Name": "Service Name",
    "Eligibility Condition": "Eligibility Condition"
}

serviceProviders

This section is for the Service provider management and the Admin section of the requirements. Particularly the ability to create and manage needs.

RouteMethodParametersAction
providersPOSTProvider type
Service provider data
Create a service provider
providersGETFetch all service providers
providers/:idGETFetch the service provider with the specified ID
providers/:idDELETEDelete the service provider with the specified ID
provider/:idPUTProvider type
Service provider data
Update the service provider with the specified ID using the information in the given form

need

This section is for the Admin section of the requirements. Particularly the ability to create and manage needs.

RouteMethodParametersAction
needPOSTNeed formCreate a need
needsGETFetch all needs
need/:idDELETEDelete the need with the specified ID
need/:idGETFetch the need with the specified ID
need/:idPUTNeed formUpdate the need with the specified ID using the information in the given form

needSatisfier

This section is for the Admin section of the requirements. Particularly the ability to create and manage need satisfiers.

RouteMethodParametersAction
needSatisfierPOSTNeed satisfier formCreate a need satisfier
needSatisfiersGETFetch all need satisfiers
needSatisfier/:idDELETEDelete the need satisfier with the specified ID
needSatisfier/:idGETFetch the need satisfier with the specified ID
needSatisfier/:idPUTNeed satisfier formUpdate the need satisfier with the specified ID using the information in the given form

outcome

This section is for the Admin section of the requirements. Particularly the ability to create and manage outcomes.

RouteMethodParametersAction
outcomePOSTOutcome formCreate an outcome
outcomesGETFetch all outcomes
outcome/:idDELETEDelete the outcome with the specified ID
outcome/:idGETFetch the outcome with the specified ID
outcome/:idPUTOutcome formUpdate the outcome with the specified ID using the information in the given form

internalType

RouteMethod
internalTypes/:formTypeGET

serviceProvision

RouteMethod
needOccurrences/client/:clientGET
serviceOccurrences/service/:serviceGET
needSatisfiers/serviceOccurrence/:serviceOccurrenceGET
needSatisfiers/service/:serviceGET