API Introduction

UT Track API consists of 12 resource objects; expect responses to be in JSON. Resources in the current version are:


1. All Orders
2. Fetch Single Order
3. Create New Order
4. Delete Orders
5. All drivers
6. Fetch Single Driver
7. Create New Driver
8. Delete Driver
9. All User
10. Fetch Single User
11. Create New User
12. Delete User

All Orders

Parameter Type # Description
o_no Intiger Required order number.
ref string Required order Refreance
o_location string Required Order Address

Example Code




$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_all_orders";

$client = curl_init($api_url);

curl_setopt($client, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($client);

$result = json_decode($response);

$output = '';

if(count($result) > 0)
{
	foreach($result as $row)
	{
		$output .= '
		'.$row->o_no.' '.$row->ref.''.$row->o_location.';
	}
}
else
{
	$output .= '
	
		No Data Found
	
	';
}

echo $output;

Fetch Single Order

Parameter Type # Description
o_no Intiger Required order number.
ref string Required order Refreance
o_location string Required Order Address

Example Code



	if($_POST["action"] == 'fetch_single_order')
	{
		$id = $_POST["id"];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_single_order&id=".$id."";  
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}

New Order

Parameter Type # Description
o_no Intiger Required order number.
ref string Required order Refreance
o_location string Required Order Address

Example Code



if($_POST["action"] == 'insert_order')
	{
		$form_data = array(
			'ref'	=>	'uu77',
			'o_location'		'KSA'
		);
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=insert_order"; 

		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_POST, true);
		curl_setopt($client, CURLOPT_POSTFIELDS, $form_data);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		curl_close($client);
		$result = json_decode($response, true);
		foreach($result as $keys => $values)
		{
			if($result[$keys]['success'] == '1')
			{
				echo 'insert';
			}
			else
			{
				echo 'error';
			}
		}
	}

Delete Order

Parameter Type # Description
o_no Intiger Required order number.
ref string Required order Refreance
o_location string Required Order Address

Example Code



if($_POST["action"] == 'delete_order')
	{
		$id = $_POST['id'];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=delete_order&id=".$id.""; 
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}

All Drivers

Parameter Type # Description
u_id Intiger Required driver number.
u_name string Required driver name
phone string Required phone number

Example Code



$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_all_drivers";

$client = curl_init($api_url);

curl_setopt($client, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($client);

$result = json_decode($response);

$output = '';

if(count($result) > 0)
{
	foreach($result as $row)
	{
		$output .= '
		
		    $row->u_id.''.$row->u_name.''.$row->u_email;
	}
}
else
{
	$output .= '
	
		No Data Found
	
	';
}

echo $output;

Fetch Single Driver

Parameter Type # Description
u_id Intiger Required driver number.
u_name string Required driver name
phone string Required phone number

Example Code



if($_POST["action"] == 'fetch_single_driver')
	{
		$id = $_POST["id"];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_single_driver&id=".$id.""; 
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}
	
		No Data Found
	
	';
}

echo $output;

New Driver

Parameter Type # Description
u_id Intiger Required driver number.
u_name string Required driver name
phone string Required phone number

Example Code



if($_POST["action"] == 'insert_driver')
	{
		$form_data = array(
			'u_name'	=>	'Ali',
			'phone'		=>	'091237809'
		);
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=insert_driver"; 
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_POST, true);
		curl_setopt($client, CURLOPT_POSTFIELDS, $form_data);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		curl_close($client);
		$result = json_decode($response, true);
		foreach($result as $keys => $values)
		{
			if($result[$keys]['success'] == '1')
			{
				echo 'insert';
			}
			else
			{
				echo 'error';
			}
		}
	}
	
		No Data Found
	
	';
}

echo $output;

Delete Driver

Parameter Type # Description
u_id Intiger Required driver number.
u_name string Required driver name
phone string Required phone number

Example Code


if($_POST["action"] == 'delete_driver')
	{
		$id = $_POST['id'];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=delete_driver&id=".$id."";
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}
	
		No Data Found
	
	';
}

echo $output;

All Users

Parameter Type # Description
u_id Intiger Required user number.
u_name string Required driver name
phone string Required phone number

Example Code




$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_all";

$client = curl_init($api_url);

curl_setopt($client, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($client);

$result = json_decode($response);

$output = '';

if(count($result) > 0)
{
	foreach($result as $row)
	{
		$output .= '
		'.$row->id.' '.$row->name.''.$row->email.';
	}
}
else
{
	$output .= '
	
		No Data Found
	
	';
}

echo $output;

Fetch Single User

Parameter Type # Description
u_id Intiger Required driver number.
u_name string Required driver name
phone string Required phone number

Example Code



if($_POST["action"] == 'fetch_single')
	{
		$id = $_POST["id"];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=fetch_single&id=".$id."";
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}

New User

Parameter Type # Description
u_id Intiger Required user number.
u_name string Required user name
phone string Required phone number

Example Code



if($_POST["action"] == 'insert')
	{
		$form_data = array(
			'u_name'	=>	'omer',
			'phone'		=>	'08900232'
		);
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=insert"; 
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_POST, true);
		curl_setopt($client, CURLOPT_POSTFIELDS, $form_data);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		curl_close($client);
		$result = json_decode($response, true);
		foreach($result as $keys => $values)
		{
			if($result[$keys]['success'] == '1')
			{
				echo 'insert';
			}
			else
			{
				echo 'error';
			}
		}
	}

Delete User

Parameter Type # Description
u_id Intiger Required user number.
u_name string Required user name
phone string Required phone number

Example Code



if($_POST["action"] == 'delete')
	{
		$id = $_POST['id'];
		$api_url = "https://www.uttrack.com/UTT-API/api/test_api.php?action=delete&id=".$id.""; 
		//change this url as per your folder path for api folder
		$client = curl_init($api_url);
		curl_setopt($client, CURLOPT_RETURNTRANSFER, true);
		$response = curl_exec($client);
		echo $response;
	}