Object Iframe embedding plugin

Follow

If you want to show location or route of some object, there is widget for that, what is meant to host in other webpage inside iframe.

Requirements

First, you need API user for that. Please contact your customer manager or sales representative to get API key.

If you have permission to change user-rights for changing persons, please go to settings - persons, select your API user, and share out only vehicles, what should be visible for it. Also, API user should have access to vehicles module.

NB! Because of this plugin contains API key, what is easily accessible for everyone, who can open source codes of webpages, make sure that API user has minimum set of permissions, and no user-rights to change any settings.

Using

It's good practice to use that plugin in iframe, not publicly link as separate address, so API key is not visible for everyone.

Plugin locates on address:

https://app.ecofleet.com/seeme/plugins/embed

You can add parameters with GET parameters.

Syntax

embed (key=api-key, id=objectid [, past=days | from = startdate, to = enddate])
  • u: API key
  • id: object ID, unique number of vehicle. See subheading below, how to get that ID
  • past: number of days ago, how old route is shown. 0=today, 1=since yesterday, 2=since day before yesterday etc...
  • from: start time of route in format YYYY-MM-DD. Time defaults to 00:00. Works with to variable. If omitted, to alone has no effect.
  • to: end time of route in format YYYY-MM-DD. Time defaults to 23:59:59, or end of the day. If not used, defaults to current moment.

Note that past is stronger than from+to, so if both are passed to embed, past is used.

Getting object ID

If you want to show specific car, You have to use API call Api/Vehicle/get to get list of objects supported by your API user. You need to use id value of that command.

Following examples use demo key, so this call gives following output (reduced here):

<nodes>
  <status>0</status>
  <response>
    <node key="0">
      <id>19285</id>
      <name>Scania R410</name>
      <plate>078ECO</plate>
    </node>
    <node key="1">
      <id>56462</id>
      <name>Robotniiduk</name>
      <plate>231ECO</plate>
    </node>
  </response>
</nodes>

So supported keys are 19285 and 56462.

Examples

We are going to use API key demo, what belongs to Estonian demo account.

1. Last positions of all cars:

https://app.ecofleet.com/seeme/plugins/embed/?u=demo

2. Current position of one car:

https://app.ecofleet.com/seeme/plugins/embed/?u=demo&id=56462

Note that we passed id=56462, what was part of response in previous API response.

3. Route of current day

https://app.ecofleet.com/seeme/plugins/embed/?u=demo&id=56462&past=0

4. route since day before yesterday

https://app.ecofleet.com/seeme/plugins/embed/?u=demo&id=56462&past=2

5. route between specified times

https://app.ecofleet.com/seeme/plugins/embed/?u=demo&id=56462&from=2020-04-14&to=2020-04-20

 

Was this article helpful?
0 out of 0 found this helpful