Metrotec API 2.0 (1.0.0)

Download OpenAPI specification:

Introduction

Metrotec API is a RESTful web service that allows developers to programmatically interact with Metrotec data over HTTPS using JSON. The base URL for the Metrotec API is https://api.metrotec.ee/public/ If you have questions about using the API or need to report a bug, please email us at info@metrotec.ee.

User-Agent

Set a clearly identifiable User-Agent HTTP header that uniquely identifies your company and integration software. Please use only printable ASCII characters. Examples of good practice (substitute your own names):

User-Agent: MyDomain.com
User-Agent: MyApplication
User-Agent: MyApplication/1.0.0
User-Agent: MyApplication/1.0.0 (api-requests/1.0.0)

Versioning

All API requests must specify the version of the API that your integration was built with. Add this version number to the Accept HTTP header as an additional argument. Replace X.Y.Z in the following example with the most recent version number shown at the top of the documentation page:

GET /routelog/ HTTP/1.1
Host: api.metrotec.ee
Accept: application/json; version=X.Y.Z
User-Agent: MyApplication/1.0.0

You can use the browsable API without specifying a version for development purposes, but all production system requests must include the version in the Accept header.

Language

The API responds with names and labels in English by default. To receive localized responses, indicate your preferred language using the appropriate HTTP header.

Time Zones

Timestamps in the API are in UTC by default. Timestamps displayed in the web and mobile apps use the account timezone, which typically differs from UTC.

Errors

Metrotec uses conventional HTTP response codes to indicate the success or failure of API requests: - 2xx range: Success - 4xx range: Error based on provided information - 5xx range: Error with Metrotec's servers

Status code Status text Description
200 OK Request succeeded
400 Bad Request Often missing a required parameter
401 Unauthorized No valid auth token provided
404 Resource not found Parameters were valid but request not found
50* Server Errors Something went wrong on our end

Authentication

Use your Metrotec username and password for API authentication. See the "Authorization" section for information on generating an API token. To authenticate, include the token in the Authorization HTTP header: Authorization: Bearer [token]

Changelog

Version 1.0.0:

  • Initial public release

Authentication

User authentication endpoints

Authenticate and get JWT token

Request Body schema: application/json
required
username
required
string

User account username

password
required
string

User account password

Responses

Request samples

Content type
application/json
{
  • "username": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "jwt": "string",
  • "expires": 0
}

Tasks

Task management endpoints

List all tasks

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new task

Request Body schema: application/json
required
object_id
required
string

Vehicle registration number

start_lat
number <float>

Starting point latitude

start_lon
number <float>

Starting point longitude

start_address
string

Starting point address

lat
required
number <float>

Destination latitude

lon
required
number <float>

Destination longitude

start_time
required
string <date-time>

Task start time (UTC, YYYY-MM-DD HH:MM:SS)

stop_time
required
string <date-time>

Task expected stop time (UTC, YYYY-MM-DD HH:MM:SS)

order_ref
required
string

Reference number from your system (must be unique)

order_details
string

Order details, client name, etc.

task_address
string

Task location address

task_description
string

Task description

planned_km
number

Planned distance between start and stop points in kilometers

concrete_type
string <= 255 characters

Concrete type specification (customer specific)

concrete_strength_class
string <= 30 characters

Concrete strength class (customer specific)

environmental_class
string <= 50 characters

Environmental class specification (customer specific)

dmax
string <= 50 characters

Maximum aggregate size (customer specific)

consistency_class
string <= 50 characters

Concrete consistency class (customer specific)

cement_type
string <= 50 characters

Type of cement used (customer specific)

additives
string <= 255 characters

Additives used in concrete (customer specific)

concrete_extra_info
string <= 255 characters

Additional concrete specifications (customer specific)

concrete_extra_info2
string <= 255 characters

Secondary additional concrete specifications (customer specific)

preparation_time
string <date-time>

Concrete preparation time (YYYY-MM-DD HH:MM:SS) (customer specific)

volume
number <float>

Volume of concrete (customer specific)

unload_method
string <= 255 characters

Method used to unload concrete (customer specific)

driving_instructions
string <= 255 characters

Special instructions for drivers (customer specific)

client_id
integer

Client identifier (customer specific)

offer_number
string <= 50 characters

Offer reference number (customer specific)

ordered_volume
number <float>

Volume of concrete ordered (customer specific)

delivered_volume
number <float>

Volume of concrete delivered (customer specific)

pumped_volume
number <float>

Volume of concrete pumped (customer specific)

work_order_number
string <= 50 characters

Work order reference number (customer specific)

notes
string <= 255 characters

Additional notes

operator_name
string <= 100 characters

Name of the operator

pumper_name
string <= 100 characters

Name of the pumping contractor/operator (customer specific)

pump_type
string <= 255 characters

Type of pump used (customer specific)

client_emails
string

Multiple client email addresses (comma-separated) (customer specific)

last_cargo
integer or null

Is last cargo in order or not (1 - is, 0 - is not) (customer specific)

Responses

Request samples

Content type
application/json
{
  • "object_id": "string",
  • "start_lat": 0.1,
  • "start_lon": 0.1,
  • "start_address": "string",
  • "lat": 0.1,
  • "lon": 0.1,
  • "start_time": "2019-08-24T14:15:22Z",
  • "stop_time": "2019-08-24T14:15:22Z",
  • "order_ref": "string",
  • "order_details": "string",
  • "task_address": "string",
  • "task_description": "string",
  • "planned_km": 0,
  • "concrete_type": "string",
  • "concrete_strength_class": "string",
  • "environmental_class": "string",
  • "dmax": "string",
  • "consistency_class": "string",
  • "cement_type": "string",
  • "additives": "string",
  • "concrete_extra_info": "string",
  • "concrete_extra_info2": "string",
  • "preparation_time": "2019-08-24T14:15:22Z",
  • "volume": 0.1,
  • "unload_method": "string",
  • "driving_instructions": "string",
  • "client_id": 0,
  • "offer_number": "string",
  • "ordered_volume": 0.1,
  • "delivered_volume": 0.1,
  • "pumped_volume": 0.1,
  • "work_order_number": "string",
  • "notes": "string",
  • "operator_name": "string",
  • "pumper_name": "string",
  • "pump_type": "string",
  • "client_emails": "string",
  • "last_cargo": 0
}

Get task by ID

path Parameters
id
required
integer

Task ID

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "oid": "string",
  • "object_id": "string",
  • "lon": 0.1,
  • "lat": 0.1,
  • "start_lat": 0.1,
  • "start_lon": 0.1,
  • "start_address": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "stop_time": "2019-08-24T14:15:22Z",
  • "order_ref": "string",
  • "order_details": "string",
  • "task_address": "string",
  • "task_description": "string",
  • "cancel_reason": "string",
  • "status": 1,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "work_started_at": "2019-08-24T14:15:22Z",
  • "work_finished_at": "2019-08-24T14:15:22Z",
  • "sender": "string",
  • "invoice_nr": "string",
  • "user_km": 0,
  • "distance": "string",
  • "geozone_entered_at": "2019-08-24T14:15:22Z",
  • "geozone_left_at": "2019-08-24T14:15:22Z",
  • "closeType": 0,
  • "planned_km": 0,
  • "ut": 0,
  • "alias": "string",
  • "concrete_type": "string",
  • "concrete_strength_class": "string",
  • "environmental_class": "string",
  • "dmax": "string",
  • "consistency_class": "string",
  • "cement_type": "string",
  • "additives": "string",
  • "concrete_extra_info": "string",
  • "concrete_extra_info2": "string",
  • "preparation_time": "2019-08-24T14:15:22Z",
  • "volume": 0,
  • "unload_method": "string",
  • "driving_instructions": "string",
  • "client_id": 0,
  • "offer_number": "string",
  • "ordered_volume": 0,
  • "delivered_volume": 0,
  • "pumped_volume": 0,
  • "work_order_number": "string",
  • "notes": "string",
  • "operator_name": "string",
  • "pumper_name": "string",
  • "pump_type": "string",
  • "client_emails": "string",
  • "last_cargo": 0
}

Update task

path Parameters
id
required
integer

Task ID

Request Body schema: application/json
required
object_id
string

Vehicle registration number

start_lat
number <float>

Starting point latitude

start_lon
number <float>

Starting point longitude

start_address
string

Starting point address

lat
number <float>

Destination latitude

lon
number <float>

Destination longitude

start_time
string <date-time>

Task start time (UTC, YYYY-MM-DD HH:MM:SS)

stop_time
string <date-time>

Task expected stop time (UTC, YYYY-MM-DD HH:MM:SS)

order_ref
string

Reference number from your system

order_details
string

Order details, client name, etc.

task_address
string

Task location address

task_description
string

Task description

status
integer
Enum: 1 2 3 4 5

Task status (1=Created, 2=In progress, 3=Completed, 4=Rejected, 5=Cancelled)

planned_km
number

Planned distance between start and stop points in kilometers

concrete_type
string <= 255 characters

Concrete type specification (customer specific)

concrete_strength_class
string <= 30 characters

Concrete strength class (customer specific)

environmental_class
string <= 50 characters

Environmental class specification (customer specific)

dmax
string <= 50 characters

Maximum aggregate size (customer specific)

consistency_class
string <= 50 characters

Concrete consistency class (customer specific)

cement_type
string <= 50 characters

Type of cement used (customer specific)

additives
string <= 255 characters

Additives used in concrete (customer specific)

concrete_extra_info
string <= 255 characters

Additional concrete specifications (customer specific)

concrete_extra_info2
string <= 255 characters

Secondary additional concrete specifications (customer specific)

preparation_time
string <date-time>

Concrete preparation time (YYYY-MM-DD HH:MM:SS) (customer specific)

volume
number <float>

Volume of concrete (customer specific)

unload_method
string <= 255 characters

Method used to unload concrete (customer specific)

driving_instructions
string <= 255 characters

Special instructions for drivers (customer specific)

client_id
integer

Client identifier

offer_number
string <= 50 characters

Offer reference number (customer specific)

ordered_volume
number <float>

Volume of concrete ordered (customer specific)

delivered_volume
number <float>

Volume of concrete delivered (customer specific)

pumped_volume
number <float>

Volume of concrete pumped (customer specific)

work_order_number
string <= 50 characters

Work order reference number (customer specific)

notes
string <= 255 characters

Additional notes

operator_name
string <= 100 characters

Name of the operator (customer specific)

pumper_name
string <= 100 characters

Name of the pumping contractor/operator (customer specific)

pump_type
string <= 255 characters

Type of pump used (customer specific)

last_cargo
integer or null

Is last cargo in order or not (1 - is, 0 - is not) (customer specific)

Responses

Request samples

Content type
application/json
{
  • "object_id": "string",
  • "start_lat": 0.1,
  • "start_lon": 0.1,
  • "start_address": "string",
  • "lat": 0.1,
  • "lon": 0.1,
  • "start_time": "2019-08-24T14:15:22Z",
  • "stop_time": "2019-08-24T14:15:22Z",
  • "order_ref": "string",
  • "order_details": "string",
  • "task_address": "string",
  • "task_description": "string",
  • "status": 1,
  • "planned_km": 0,
  • "concrete_type": "string",
  • "concrete_strength_class": "string",
  • "environmental_class": "string",
  • "dmax": "string",
  • "consistency_class": "string",
  • "cement_type": "string",
  • "additives": "string",
  • "concrete_extra_info": "string",
  • "concrete_extra_info2": "string",
  • "preparation_time": "2019-08-24T14:15:22Z",
  • "volume": 0.1,
  • "unload_method": "string",
  • "driving_instructions": "string",
  • "client_id": 0,
  • "offer_number": "string",
  • "ordered_volume": 0.1,
  • "delivered_volume": 0.1,
  • "pumped_volume": 0.1,
  • "work_order_number": "string",
  • "notes": "string",
  • "operator_name": "string",
  • "pumper_name": "string",
  • "pump_type": "string",
  • "last_cargo": 0
}

Delete task

path Parameters
id
required
integer

Task ID

Responses

Vehicle Data

Vehicle tracking and telematics data

Get last data for all vehicles

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get last data for specific vehicle

path Parameters
id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
{
  • "ID": 0,
  • "objectID": "string",
  • "Xpos": 0.1,
  • "Ypos": 0.1,
  • "Counter1": 0,
  • "Counter2": 0,
  • "GMTime": "2019-08-24T14:15:22Z",
  • "Speed": 0,
  • "Heading": "string",
  • "Input": 0,
  • "LastCommunicationLocalTime": "2019-08-24T14:15:22Z",
  • "Content": "string",
  • "Power": 0.1,
  • "BatLevel": 0,
  • "NoGPSFix": "string",
  • "t1": 0,
  • "t2": 0,
  • "t3": 0,
  • "t4": 0
}

Get vehicles inside a geographic polygon

Returns a list of vehicles located within a specified geographic polygon

query Parameters
coordinates
required
string
Examples: coordinates=[[24.868293,59.318745], [24.871149,59.318745], [24.871149,59.320103], [24.868293,59.320103], [24.868293,59.318745]]

Array of points [longitude, latitude] that form a polygon. Must be a correct polygon with at least 4 points where the first point equals the last point.

Responses

Response samples

Content type
application/json
[
  • "000AAA"
]

Reports

Various vehicle reports (drive, engine, fuel)

Get drive report for vehicle

path Parameters
period_start
required
string <date-time>
Examples: 2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

period_stop
required
string <date-time>
Examples: 2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get engine report for vehicle

path Parameters
period_start
required
string <date-time>
Examples: 2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

period_stop
required
string <date-time>
Examples: 2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get fuel report for vehicle

path Parameters
period_start
required
string <date-time>
Examples: 2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

period_stop
required
string <date-time>
Examples: 2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get route log for vehicle

path Parameters
start_from
required
string <date-time>
Examples: 2017-10-3121:45:57

Start date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get status report for all vehicles

Returns working and repair time for all vehicles in a specified period

query Parameters
datetime[]
required
Array of strings <date-time> [ items <date-time > ]
Examples: datetime[]=2021-11-30 22:00:00&datetime[]=2021-12-08 21:59:59

Period start and end timestamps (UTC) in format YYYY-MM-DD HH:MM:SS

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get detailed status report for a specific vehicle

Returns detailed work and repair periods for a specific vehicle

path Parameters
id
required
string

Vehicle ID

query Parameters
datetime[]
required
Array of strings <date-time> [ items <date-time > ]
Examples: datetime[]=2021-11-30 22:00:00&datetime[]=2021-12-08 21:59:59

Period start and end timestamps (UTC) in format YYYY-MM-DD HH:MM:SS

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get rides count grouped by vehicle

Returns the count of rides for each vehicle within the specified period

query Parameters
datetime[]
required
Array of strings <date-time> [ items <date-time > ]
Examples: datetime[]=2021-06-02 12:00:00&datetime[]=2021-06-02 12:59:59

Period start and end timestamps (UTC) in format YYYY-MM-DD HH:MM:SS

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Navigation

Navigation requests and responses

Get navigation requests for vehicle

path Parameters
period_start
required
string <date-time>
Examples: 2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

period_stop
required
string <date-time>
Examples: 2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new navigation request

Request Body schema: application/json
required
object_id
required
string

Vehicle registration number

type
required
string
Enum: "MESSAGE" "GETDESTINATION" "SETLOCATION" "CONTROL"

Request type

lat
number <float>

Latitude (required for SETLOCATION type)

lon
number <float>

Longitude (required for SETLOCATION type)

functionId
string <= 140 characters

Function ID

msg
string <= 140 characters

Message text (for CONTROL type, valid values are OUT1ON, OUT1OFF, OUT2ON, OUT2OFF, OUT3ON, OUT3OFF, OUT4ON, OUT4OFF)

Responses

Request samples

Content type
application/json
{
  • "object_id": "string",
  • "type": "MESSAGE",
  • "lat": 0.1,
  • "lon": 0.1,
  • "functionId": "string",
  • "msg": "string"
}

Response samples

Content type
application/json
[
  • {
    }
]

Get navigation answers for vehicle

path Parameters
period_start
required
string <date-time>
Examples: 2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

period_stop
required
string <date-time>
Examples: 2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

vehicle_id
required
string

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

POI

Points of interest management

Get all points of interest

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new point of interest

Request Body schema: application/json
required
lat
required
number <float>

Latitude

lon
required
number <float>

Longitude

name
string <= 50 characters

POI name

purpose
required
integer

POI purpose - 0-POI, 1-Customer, 2-WIFI router, 3-Bluetooth beacon

comment
required
string <= 255 characters

POI comment. If Wifi Router or Bluetooth beacon, is required and should be valid MAC address.

type
integer [ 1 .. 9 ]
Default: 1

POI group

radius
integer
Default: 50

POI radius in meters

rgAddress
string

POI address

phone_nr
string

Phone number

country_code
string

Phone country number

contact_name
string

Contact name

Responses

Request samples

Content type
application/json
{
  • "lat": 24.868293,
  • "lon": 59.318745,
  • "name": "Home",
  • "purpose": 0,
  • "comment": "AD-6A-9F-DA-13-7D",
  • "type": 1,
  • "radius": 10,
  • "rgAddress": "Vehemaa tee 5, Viimsi",
  • "phone_nr": "55667788",
  • "country_code": "+1",
  • "contact_name": "King Arthur"
}

Drivers

Driver information endpoints

Get list of all vehicle drivers

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get list of drivers for specific vehicle

query Parameters
startUse
string <date-time>
Examples: startUse=2017-10-2400:00:00

Start date in format YYYY-MM-DDHH:MM:SS

stopUse
string <date-time>
Examples: stopUse=2017-10-3123:59:59

End date in format YYYY-MM-DDHH:MM:SS

object_id
required
string
Examples: object_id=000AAA

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Booking

Booking management endpoints

Get all bookings

query Parameters
datetime[]
Array of any <date-time> [ items <date-time > ]
Examples: datetime[]=2024-10-24 00:00:00&datetime[]=2024-10-31 23:59:59

Start and end date in format YYYY-MM-DD HH:MM:SS

object_id
string
Examples: object_id=000AAA

Vehicle ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Documents

Document generation endpoints (waybills, reports)

Receive one or more waybills in a single PDF file

Requests waybill(s) in PDF file format

query Parameters
nr[]
required
Array of integers
Examples: nr[]=1047039&nr[]=1047031&nr[]=1044619

Waybill number(s)

Responses

Get waybills by work order number as PDF

Packages waybills related to a work order number into a single PDF file

path Parameters
work_order_number
required
string

Work order number

Responses

Waybills

Waybill management endpoints

List opened waybills

Returns a list of all currently opened waybills (all datetime values are in UTC)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Stock Data

Fuel tank and stock monitoring endpoints

Get all recent stock data

Requests recent information from all objects with fuel tank data

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get stock data with next refill time by tank

Requests recent information together with the next refill time from specified tank

path Parameters
object_id
required
string

Object ID/Tank identifier

Responses

Response samples

Content type
application/json
[
  • {
    }
]