REST
REST
All components are very general guidelines. Overall design and aesthetic choices are left to the
discretion of the designer. Refer to the REST API documentation for specific field names,
responses, and URLs. The final web application project should be built with Vue and
obfuscated/optimized with webpack.
Register
User registration page that contains a textbox for the following information:
● Username
● Email address
● Password
● Password verification
● Captcha
Forms should be validated prior to submission. Must not refresh page upon submission.
Seamlessly transfer to main application interface. Display error messages cleanly. Upon
success, redirect to main Signals page.
Login
User login page that contains a textbox for the following information:
● username
● password
● mfatoken (Hidden at first. Only show upon a 202 response.)
When the user submits his or her credentials, the server does not differentiate between users
not existing and incorrect credentials (to prevent user enumeration). This should be reflected in
the web application. A 202 will be sent indicating that the MFA token field should be visible.
Payment
Payment page that displays information on the various subscriptions plans. Just contains links
to the selly application as well as displaying the username.
Signals
Should immediately query for existing signals via the REST API once the component loads and
display them cleanly in a table in descending order of when they were received (Newest First).
The websocket connection should also take place within this component. Any new item sent
over the websocket should be added to the displayed table. It should be obvious that a new
signal has been generated (flash of highlighted color, bell sound, etc)
Settings
There is currently little server-side functionality for saving user settings.
Rest API Documentation
Authentication
All authentication uses JSON Web Tokens. Each request (after authentication) requires an
authorization header in the form of:
Where xxx.xxx.xxx is the JWT token value. The JWT is comprised of three parts, separated by a
period delimiter. Note: Base64 data used is escaped with non-default characters to make them
URL safe (“-” and “_” replace “+” and “/” respectively). In JavaScript, I used the following
function as a getter for a VueX store:
Any further reference to “Base64 encoding” pertaining to the JWT will assume this URL
escaped modified function.
JWT Token Layout
POST
Constraints
● username regex:
^[a-zA-Z][a-zA-Z0-9_\-\.]{2,14}$
● email regex:
^(([^<>()\[\]\\.,;:\s@\"]+(\.[^<>()\[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[
0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$
Response Parameters
● success Always given. Boolean value.
● message Always given. String/status message.
● fields Given with 422. List of strings containing the names of fields with
invalid values.
Authenticates the user. Web app should display a username/password prompt. It should display
a 2FA token ONLY when a 422 status code is returned. The HTTP response will contain an
Authorization Bearer token. This token must be used for all subsequent requests.
POST
GET
● JWT token required via Authorization HTTP header.
POST
● Authentication token NOT required. API key used instead for stateless/sessionless
authentication. Not required to be submitted via the web app. 3rd party libraries/tools will
be used.
Signal Websocket Feed
ws://api.example.com/v1/signals/feed
Websocket will automatically close if the subscription expires. Here’s an example of it expiring
during a connection: