Data Models
Contents
Data Models
This section provides detailed information about the data models used by the Adastra Toll API for both requests and responses. Understanding these data structures is crucial for successful API integration.
Toll Calculation Endpoint Data Models
Request Model
The request body for the Toll Calculation endpoint is a JSON object with the following structure:
{
"vehicleTypeId": "string",
"lang": "string",
"mapsource": "string",
"expandTollsData": "boolean",
"departureTime": "string",
"steps": "string"
}
vehicleTypeId
:- Type:
string
- Description: The ID of the vehicle type.
- Possible Values:
"1"
,"2"
,"3"
,"4"
,"5"
,"6"
- Type:
lang
:- Type:
string
- Description: The language code for the response.
- Possible Values:
"en"
,"tr"
- Type:
mapsource
:- Type:
string
- Description: The source of the map data.
- Possible Values:
"google"
,"tomtomv1"
,"tomtomv2"
- Type:
expandTollsData
:- Type:
boolean
- Description: A flag to indicate whether the tolls data should be expanded.
- Type:
departureTime
:- Type:
string
- Description: The departure time of the route in ISO 8601 format.
- Type:
steps
:- Type:
string
- Description: The route’s coordinates string.
- Type:
Response Model
The response from the Toll Calculation endpoint is a JSON object with the following structure:
{
"status": "string",
"code": "integer",
"message": "string",
"data": {
"totalPrice": "number",
"currency": "string",
"vehicle": {
"type": "string",
"code": "string"
},
"companyPrices": {
"KGM": {
"totalPrice": "number",
"tollCount": "integer"
}
},
"calculatedAt": "string",
"tolls": [
{
"highwayCode": "string",
"companyCode": "string",
"routeEntry": "string",
"routeExit": "string",
"priceAmount": "number",
"priceType": "string",
"tollType": "string",
"tollStructure": "string",
"found": "boolean",
"order": "integer"
}
],
"elapsedMilliseconds": "integer",
"tollingStartDate": "integer",
"cache": "boolean"
}
}
status
:- Type:
string
- Description: The status of the API request.
- Type:
code
:- Type:
integer
- Description: The HTTP status code of the response.
- Type:
message
:- Type:
string
- Description: A message indicating the result of the operation.
- Type:
data
:- Type:
object
- Description: An object containing the toll calculation results.
totalPrice
:- Type:
number
- Description: The total toll price for the route.
- Type:
currency
:- Type:
string
- Description: The currency of the toll price.
- Type:
vehicle
:- Type:
object
- Description: Information about the vehicle used for calculation.
type
:- Type:
string
- Description: The type of vehicle.
- Type:
code
:- Type:
string
- Description: The vehicle type ID.
- Type:
- Type:
companyPrices
:- Type:
object
- Description: An object containing the toll prices for each company.
KGM
:- Type:
object
- Description: Toll prices for KGM (Karayolları Genel Müdürlüğü).
totalPrice
:- Type:
number
- Description: Total toll price for KGM.
- Type:
tollCount
: * Type:integer
* Description: Total count for KGM tolls.
- Type:
- Type:
calculatedAt
:- Type:
string
- Description: The timestamp of when the calculation was performed.
- Type:
tolls
:- Type:
array
- Description: An array of objects, each representing a toll on the route.
highwayCode
:- Type:
string
- Description: The code of the highway on which the toll is located.
- Type:
companyCode
:- Type:
string
- Description: The code of the company operating the toll.
- Type:
routeEntry
:- Type:
string
- Description: The entry point of the toll.
- Type:
routeExit
:- Type:
string
- Description: The exit point of the toll.
- Type:
priceAmount
:- Type:
number
- Description: The price of the toll.
- Type:
priceType
:- Type:
string
- Description: The type of price.
- Type:
tollType
: * Type:string
- Description: The type of toll.
tollStructure
: * Type:string
- Description: The structure of the toll.
found
: * Type:boolean
- Description: Boolean field that indicates if the toll was found on the route.
order
:- Type:
integer
- Description: The order of toll on the route.
- Type:
- Type:
elapsedMilliseconds
:- Type:
integer
- Description: The time taken to calculate tolls in milliseconds.
- Type:
tollingStartDate
: * Type:integer
- Description: The start date for the tolling period in the format YYYYMMDD.
cache
:- Type:
boolean
- Description: A flag to indicate whether the response was retrieved from the cache.
- Type:
- Type:
Reporting Endpoint Data Models
Request Model
The request for the Reporting endpoint is a GET
request. The parameters are passed as query strings in the URL, they are:
key
:- Type:
string
- Description: Your API key for authentication.
- Type:
secret
: * Type:string
* Description: Your secret key for authentication.reportName
:- Type:
string
- Description: The name of the report to retrieve.
- Type:
timeCriteria
:- Type:
string
- Description: The time criteria for the report.
- Type:
Response Model
The response is a JSON object with the following structure:
{
"status": "string",
"code": "integer",
"message": "string",
// Report data varies based on the reportName
"requestDateTime": "string",
"cacheDurationMinutes": "integer"
}
status
: * Type:string
* Description: The status of the API request.code
:- Type:
integer
- Description: The HTTP status code of the response.
- Type:
message
:- Type:
string
- Description: A message indicating the result of the operation.
- Type:
- Report Data: The structure of the report data varies based on the
reportName
parameter. Please refer to the Reporting Endpoint section for detailed report structures. requestDateTime
: * Type:string
* Description: The time the report request was made.cacheDurationMinutes
: * Type:integer
* Description: The number of minutes the report will be cached by the server.
Please refer to the Reporting Endpoint section for detailed data structures for each report type.
Important Considerations
- Understanding the data types and structures is crucial for correct API usage.
- Refer to the specific endpoint documentation for detailed information about each parameter and field.
- The data models can be used as a guide for parsing and handling data in your application.