Mock server for automation job candidates.
- Server implements RESTful API
- All API responses are formatted in JSON
- The server will be answering to requests on port 5000 (http://localhost:5000)
If you're unfamiliar with the HTTP status code, you may find this information useful: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
- Python 2.7.x: https://www.python.org/downloads/release/python-2712/
- Pip 8.1 or above: https://pip.pypa.io/en/stable/installing/
As best practice (not mandatory), we recommend installing virtualenv and virtualenvwrapper.
-
Installing virtualenv: https://virtualenv.pypa.io/en/latest/installation/
-
Installing virtualenvwrapper: https://virtualenvwrapper.readthedocs.io/en/latest/install.html
Then, to install project prerequisites, inside the project root, run:
pip install .
C:\path\to\app>set FLASK_APP=server.py
C:\path\to\app>flask run
export FLASK_APP=server.py
flask run
Authentication is not required.
Following is the complete list of endpoints to work against.
Description: Listing tasks
Usage: GET /tasks
Produces: application/json
Sample response:
{}
Description: Get a single task
Usage: GET /tasks/<task_id>
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
Sample response:
{
"task": "add task",
"completed": false
}
Description: Create a task
Usage: POST /tasks/<task_id>
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
JSON formatted object with attributes:
- task: task title
- completed: (boolean) whether task is completed
Sample request:
{
"task": "add task",
"completed": false
}
Sample response:
{
"task_id": "1234",
}
Description: Modifies an existing task
Usage: PUT /tasks/<task_id>
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
Sample request:
{
"task": "add task",
"completed": false
}
Sample response:
{
"task_id": "1234",
}
Description: Mark an existing task as completed
Usage: POST /tasks/<task_id>/completed
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
Sample response:
{}
Description: Mark an existing task as incomplete
Usage: POST /tasks/<task_id>/incomplete
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
Sample response:
{}
Description: Delete an existing task
Usage: DELETE /tasks/<task_id>
Produces: application/json
- <task_id>: task id. Can be retrieved when creating a new task, or when listing all tasks.
Sample response:
{}