Software Developer Technical Task
Software Developer Technical Task
Introduction
You are a Software Developer in a company building truck management solutions. The
solution is supposed to run on a mobile app and a web-based backend. The
communication between the backend manager and the mobile app is defined with a
set of API commands.
API
https://api.mosmarts.com/truck/v0/api.php
The API is scripted in PHP and accepts GET & POST commands and in return it responds
back with a JSON response data.
To retrieve data the API requires “functionality” and “action” among other params as
show below.
Payloads
{
"functionality" : "get",
"action" : "get_all_truck"
}
Payloads
{
"functionality" : "get",
"action" : "get_inspection_history",
"truckId" : "1"
}
{
"response":
{
"action":"get_all_truck",
"code":1,
"message":"Success",
"data":[
{"id":0,"title":"Consolidated"},
{"id":3,"title":"KBH 778L"},
{"id":4,"title":"KBH 807N"},
{"id":5,"title":"KBM 921D"},
{"id":6,"title":"KBQ 264Z"},
{"id":2,"title":"KBQ 266Z"},
{"id":7,"title":"KBY 292H"},
{"id":1,"title":"KBY 441J"}
],
"status":null,
"privilege":null,
"position":null
}
}
Error response
{
"response":
{
"action":"get_inspection_checklist",
"code":0,
"message":"An error has occurred, please try again",
"data":[],
"status":null,
"privilege":null,
"position":null
}
}
What’s expected from you
As the software developer you are tasked to design and develop a web-based
backend solution that will have:
1. Dashboard: -
• Retrieve and indicate total number of trucks
• Retrieve and indicate number of inspection repairs requested
2. List all Trucks: -
• Implement search option
3. Inspection List: -
• Implement filter by truck
Useful files
Create get_data.php file and paste the code
<?php
$fields = json_encode($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.mosmarts.com/truck/v0/api.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
print($response);
?>