[Ovmsdev] Dexter'web API

Michael Balzer dexter at expeedo.de
Sat Sep 28 15:43:51 HKT 2019


FYI:

The V2 REST/JSON API on my server is now also available with SSL. The SSL server is on port 6869, so API calls will be…

https://ovms.dexters-web.de:6869/api/cookie?username=…&password=…
https://ovms.dexters-web.de:6869/api/vehicles
…etc.

I've also changed this on the simpleclient API test page (https://ovms.dexters-web.de/f/simpleclient.htm).

The encryption uses my standard web server certificate generated by Let's encrypt.

If you'd like to do this for your personal V2 server, all you need to do is cat the privkey.pem + fullchain.pem into a file "ovms_server.pem" located in the
ovms_server.pl working directory (and restart the daemon).

As "ovms_server.pem" contains the private key, you should make it owned & readable only by the daemon user. Put all of that into a script and automate renewals
via cron.

#!/bin/bash

# ovms_server.pl needs a combined PEM file with privkey + fullchain,
# readable only by the user:

PKEY=/etc/letsencrypt/live/dexters-web.de/privkey.pem
CERT=/etc/letsencrypt/live/dexters-web.de/fullchain.pem

USER=sddexter
PEM=/sd/sddexter/files/server/ovms_server.pem

if [[ $UID -ne 0 ]] ; then
  echo "$0 needs to be run as root"
  exit 1
fi

if [[ $CERT -nt $PEM ]] ; then
  echo "OVMS SSL certificate renewal detected, installing..."
  cat $PKEY $CERT >$PEM
  chmod 0600 $PEM
  chown $USER. $PEM
  service ovms restart
fi


Regards,
Michael


Am 13.07.18 um 10:33 schrieb Michael Balzer:
> Hi Tim,
>
> my server offers the standard OVMS server APIs…
>
>   * TCP: https://github.com/openvehicles/Open-Vehicle-Monitoring-System/raw/master/docs/OVMS-Protocol.pdf
>   * REST/JSON: http://lists.openvehicles.com/pipermail/ovmsdev/2013-October/001667.html
>       o Test: http://ovms.dexters-web.de/f/simpleclient.htm
>       o Note: no SSL support
>
> …plus an additional stateless REST API on http/https:
>
>   * Text command:
>     https://dexters-web.de/api/call?fn.name=ovms/cmd&fn.vehicleid=…&fn.carpass=…&fn.cmd=…
>
>   * CSV data export:
>     https://dexters-web.de/api/call?fn.name=ovms/export&fn.vehicleid=…&fn.carpass=…
>
>     Optional parameters:
>     - fn.format: "csv" (=inline) / "zip" (default)
>     - fn.types: string, data types to download; comma separated list or SQL LIKE pattern
>     - fn.since: ISO format timestamp, filter newer records
>     - fn.last: integer, output last n records
>
>     Example:
>     https://dexters-web.de/api/call?fn.name=ovms/export&fn.vehicleid=…&fn.carpass=…&fn.format=csv&fn.types=D,S&fn.last=3
>
>
> Regards,
> Michael
>
>
> Am 13.07.2018 um 08:12 schrieb Tim Jackson:
>> Hi there all,
>>
>> I have 2 of the latest units, and I am running a Nissan Leaf and e-NV200..
>>
>> I have 2 questions
>>
>> 1. Is there an API for dexter-web.de <http://dexter-web.de> site?
>> 2. Is there any updated documentation on the current API on TMC?
>>
>> Thanks
>>
>> Tim
>>
>>
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.openvehicles.com
>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
> -- 
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20190928/2b26d99b/attachment.html>


More information about the OvmsDev mailing list