Groups
- This method returns the list of Vehicle Groups for your client.
-
Returns two pieces of information:
- sourceId (Group Id)
- name (Group Name)
Use Case
- Use to display groups in dropdowns / filters.
- Use sourceId as the group identifier in other APIs.
Use an HTTP GET request to obtain your list of groups:
[GET] https://secure.trackyourtruck.com/WebApi/api/v2.2/groups
Request Header
The request header should contain the API Access Token obtained from the authentication process. Get Access Token.
| Header Name | Description |
|---|---|
| Authorization | Access Token obtained from the authentication process (Bearer Token). |
Request Examples
Below are the Groups request API examples:
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN");
var response = await client.GetAsync("https://secure.trackyourtruck.com/WebApi/api/v2.2/groups");
var responseString = await response.Content.ReadAsStringAsync();
// responseString will contain the response in JSON format
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
},
type: "GET",
url: "https://secure.trackyourtruck.com/WebApi/api/v2.2/groups",
dataType: "json",
success: function(data){
// data object will contain the result as a JSON object
}
});
Sample Response
A successful request will return the following JSON result:
{
"StatusCode": "200",
"Message": "OK",
"pagination": {
"PageNumber": 1,
"PageSize": 100,
"TotalRecords": 1250,
"TotalPages": 13,
"HasMore": true
},
"Results": [
{ "sourceId": 11541, "name": "Circle" },
{ "sourceId": 11542, "name": "Triangle" },
{ "sourceId": 11543, "name": "Square" }
..........
]
}
Test
Test the Groups endpoint using your AccessToken by entering it below:
Clicking the test button will send a request to the TYT API and display the result below.