MapUrl

  • This method returns a URL that renders a TYT vehicle tracking MAP
  • Map has the following features:
    • Displays latest location of vehicle(s) with Time
    • Displays latest Status and Status Time
    • Auto Refreshes every 30 seconds
    • Provides auto expiration of map for sharing with customers
    • Provides email and text message function to send the map link

Use Case

  • Use to display location and status information on a Map.
  • Use on your website or pass to customers for tracking of a vehicle assigned to a customer location.
  • Use to send map links via email or SMS to your customer(s).

Use an HTTP POST request to obtain your vehicle's Map URL :

[POST] https://secure.trackyourtruck.com/WebApi/api/v2.0/MapUrl

Request Header

The request header should contain the API Token obtained from the authentication process. Get Access Token.

Header Name Description
Authorization API Token obtained from the 1st step's authentication process.

Request Parameters

The Request should contain the following parameters:

Parameter Name Description Value Format Example
VehicleId (Optional) Filter by a specific VehicleID; “blank” returns all Vehicles numeric 14457
ExpireInHrs URL Expiration in hours (default is 3 hrs; MAX is 24 hours)* numeric 3
Phone (Optional) Mobile Phone Number to send Map URL as text message Phone Number 312-509-6995
Email (Optional) Email address to send Map URL name@example.com johndoe@gmail.com
*You must request a new MapUrl when your URL expires.

Create MapUrl Object

Below is the MapUrl request API examples:


var client = new HttpClient();
var values = new Dictionary
    {
        { "VehicleId", "14713 " },
        { "ExpireInHrs", "5 " },
        { "Phone", "312-509-6995" },
        { "Email", "johndoe@gmail.com" }
    };
    client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN")
    var content = new FormUrlEncodedContent(values);
    var response = await client.PostAsync("https://secure.trackyourtruck.com/WebApi/api/v2.0/MapUrl", content);
    var responseString = await response.Content.ReadAsStringAsync();

//responseString will contain a Credential Object in JSON format
$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.0/MapUrl",
    dataType: "json",
    data:{
        VehicleId : "14713" ,
        ExpireInHrs: "5",
        Phone: "312-509-6995",
        Email: "johndoe@gmail.com"
    },
    success: function(data){
        //data object will contain the result as a JSON object
    }
});

Sample MapUrl Object

$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.0/MapUrl",
    dataType: "json",
    data:{
        VehicleId : "14713" ,
        ExpireInHrs: "5",
        Phone: "312-509-6995",
        Email: "johndoe@gmail.com"
    },
    success: function(data){
        //data object will contain the result as a JSON object
    }
});

A successful request will return the following JSON result:


    {
        "StatusCode": "200",
        "Message": "OK",
        "Data": "https://secure.trackyourtruck.com/WebApi/MapView?token=ml4KzN7rlFNso3AX05JH8MwdvBwfBTdFhExEVBYfClo%3d"
    }

Test

Test the MapUrl using your AccessToken by entering it below:

Clicking the test button will send a request to the TYT API and display the result below.