0% found this document useful (0 votes)
197 views3 pages

Software Developer Technical Task

The software developer is tasked with building a web-based backend solution for a truck management system that communicates with a mobile app via API. The developer must design dashboards to display total trucks and inspection requests, allow listing and searching all trucks, and filtering inspections by truck. An API is provided that uses GET and POST commands with JSON payloads and responses to retrieve data by specifying a functionality and action. A PHP file with CURL code is provided as an example to retrieve data from the API.

Uploaded by

Gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views3 pages

Software Developer Technical Task

The software developer is tasked with building a web-based backend solution for a truck management system that communicates with a mobile app via API. The developer must design dashboards to display total trucks and inspection requests, allow listing and searching all trucks, and filtering inspections by truck. An API is provided that uses GET and POST commands with JSON payloads and responses to retrieve data by specifying a functionality and action. A PHP file with CURL code is provided as an example to retrieve data from the API.

Uploaded by

Gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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.

Command for retrieving all truck

Payloads
{
"functionality" : "get",
"action" : "get_all_truck"
}

Command to retrieving truck inspection details by id

Payloads
{
"functionality" : "get",
"action" : "get_inspection_history",
"truckId" : "1"
}

NB: you will get truckId from command "get_all_truck" above


API Response
Success response

{
"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

//params to retrieve all trucks


$fields = array(
"functionality" => "get",
"action" => "get_all_truck"
);

//params to retrieve inspection history


/*$fields = array(
"functionality" => "get",
"action" => "get_inspection_history",
"truckId" => "1"
);*/

$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);
?>

You might also like