<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div>I've implemented some more of this. Current status is that the following have been implemented and are now live and working on tmc server:<div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><span style="font-family: 'Andale Mono'; ">GET /api/cookie Login and return a session cookie</span></div></div></blockquote></div></blockquote><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><span style="font-family: 'Andale Mono'; ">DELETE /api/cookie Delete the session cookie and logout</span></div></div></blockquote></div></blockquote><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><span style="font-family: 'Andale Mono'; ">GET /api/vehicles Return a list of registered vehicles</span></div></div></blockquote></div></blockquote><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><span style="font-family: 'Andale Mono'; ">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/protocol/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return raw protocol records (no vehicle connection)</span></div></div></blockquote></div></blockquote><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/status/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle status</font></div></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/tpms/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return toms status</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/location/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle location</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle charge status</font></div></blockquote></div></blockquote><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/historical/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Request historical data summary</font></blockquote><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/historical/<VEHICLEID>/<DATATYPE><span class="Apple-tab-span" style="white-space: pre; "> </span>Request historical data records</font></blockquote></div></blockquote></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font class="Apple-style-span" face="'Andale Mono'"><br></font></div><div><font class="Apple-style-span" face="'Andale Mono'"><span class="Apple-style-span" style="font-family: Helvetica; ">The following are still being worked on:</span></font></div></div></div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><div><div><font face="Andale Mono">GET</font><span class="Apple-tab-span" style="font-family: 'Andale Mono'; white-space: pre; "> </span><font face="Andale Mono">/api/vehicle/<VEHICLEID></font><span class="Apple-tab-span" style="font-family: 'Andale Mono'; white-space: pre; "> </span><font face="Andale Mono">Connect to, and return vehicle information</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/vehicle/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Disconnect from vehicle</font></div><div><span class="Apple-style-span" style="font-family: 'Andale Mono'; ">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Set vehicle charge status</span></div></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Abort a vehicle charge</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle lock status</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Lock a vehicle</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Unlock a vehicle</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return valet status</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Enable valet mode</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Disable valet mode</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/features/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle features</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/feature/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Set a vehicle feature</font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/parameters/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return vehicle parameters</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/parameter/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Set a vehicle parameter</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/reset/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Reset the module in a particular vehicle</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/homelink/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Activate </font><span style="font-family: 'Andale Mono'; ">home link</span></div></blockquote></div></blockquote><div><br></div><div>Feel free to have a play.</div><div><br></div><div>Regards, Mark.</div><div><br></div><div>P.S. API is still being changed, so I don't suggest you write production code to it yet (until it has been documented and is stable).</div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[Ovmsdev] Fwd: HTTP API</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">22 February, 2013 10:17:23 PM GMT+08:00<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Reply-To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></span></div><br><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div>I've done some work on this, and tidied up the foundational servers. I've now got a basic framework working in the non-blocking environment of ovms_server.pl.<div><br></div><div>You can try this yourself using <a href="http://tmc.openvehicles.com/api">http://tmc.openvehicles.com/api</a>. At the moment I've only enabled HTTP. I'll enable HTTPS (the server already supports it - I just need to install the certificates) when we are ready for production.<br><div><br></div><div>The first thing you must do to use the api is authenticate to establish a session and get a cookie (so you don't need to authenticate every time). This is done with a http "GET /api/cookie" passing parameters 'username' and 'password' as your <a href="http://www.openvehicles.com/">www.openvehicles.com</a> username and password respectively.</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font face="Andale Mono">$ curl -v -X GET -c cookiejar <a href="http://tmc.openvehicles.com:6868/api/cookie?username=USERNAME\&password=PASSWORD">http://tmc.openvehicles.com:6868/api/cookie?username=USERNAME\&password=PASSWORD</a><br>* About to connect() to <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a> port 6868 (#0)<br>* Trying 64.111.70.40...<br>* connected<br>* Connected to <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a> (64.111.70.40) port 6868 (#0)<br>> GET /api/cookie?username=USERNAME&password=PASSWORD HTTP/1.1<br>> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5<br>> Host: <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a>:6868<br>> Accept: */*<br>> <br>* HTTP 1.0, assume close after body<br>< HTTP/1.0 200 Authentication ok<br>< Connection: close<br>< Content-Length: 9<br>< Cache-Control: max-age=0<br>< Content-Type: text/plain<br>* Added cookie ovmsapisession="9ed66d0e-5768-414e-b06d-476f13be40ff" for domain <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a>, path /api/, expire 0<br>< Set-Cookie: ovmsapisession=9ed66d0e-5768-414e-b06d-476f13be40ff<br>< Date: Fri, 22 Feb 2013 12:43:56 GMT<br>< Expires: Fri, 22 Feb 2013 12:43:56 GMT<br>< <br>Login ok</font></div></blockquote></div><div><br></div><div>Once logged in, all subsequent requests should pass the cookie (ovmsapisession). The session will expire after 3 minutes of no use, or you can specifically terminate / logout the session by calling "DELETE /api/cookie".</div><div><br></div><div>We could have other authentication mechanisms, but I'm really trying to move to a simple username/password mechanism.</div><div><br></div><div>To obtain a list of vehicles on your account, you can use the "GET /api/vehicles" call:</div><div><br></div><div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font face="Andale Mono">$ curl -v -X GET -b cookiejar <a href="http://tmc.openvehicles.com:6868/api/vehicles">http://tmc.openvehicles.com:6868/api/vehicles</a><br>* About to connect() to <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a> port 6868 (#0)<br>* Trying 64.111.70.40...<br>* connected<br>* Connected to <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a> (64.111.70.40) port 6868 (#0)<br>> GET /api/vehicles HTTP/1.1<br>> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5<br>> Host: <a href="http://tmc.openvehicles.com/">tmc.openvehicles.com</a>:6868<br>> Accept: */*<br>> Cookie: ovmsapisession=9ed66d0e-5768-414e-b06d-476f13be40ff<br>> <br>* HTTP 1.0, assume close after body<br>< HTTP/1.0 200 Logout ok<br>< Connection: close<br>< Content-Length: 280<br>< Cache-Control: max-age=0<br>< Content-Type: application/json<br>< Date: Fri, 22 Feb 2013 12:44:41 GMT<br>< Expires: Fri, 22 Feb 2013 12:44:41 GMT<br>< <br>[</font></div><div><font face="Andale Mono"> {"id":"DEMO","v_apps_connected":0,"v_net_connected":1},</font></div><div><font face="Andale Mono"> {"id":"MARKSCAR","v_apps_connected":1,"v_net_connected":1},</font></div><div><font face="Andale Mono"> {"id":"QCCAR","v_apps_connected":0,"v_net_connected":0},</font></div><div><font face="Andale Mono"> {"id":"RALLYCAR","v_apps_connected":0,"v_net_connected":0},</font></div><div><font face="Andale Mono"> {"id":"TESTCAR","v_apps_connected":0,"v_net_connected":0}</font></div><div><font face="Andale Mono">]</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">(note that the above is re-formatted slightly, to make it clearer to read).</font></div></blockquote><div><br></div><div>The return data is a json formatted array of hashes. Each record is one for one vehicle and shows you the vehicle id, as well as counts for the number of apps currently connected to that vehicle, and whether the vehicle is connected to the net (server) or not.</div><div><br></div><div>From the server point of view, we can treat an api session just like an app session. From the vehicle point of view there will be no difference - once an API connects to a vehicle, the server will send a "Z 1" message to tell the module it has a connection. If the session times out or is logged out, the server will inform the modules in the vehicles.</div><div><br></div><div>The above has all been implemented, and you can try it.</div><div><br></div><div>The following commands are what I am thinking about:</div><div><br></div></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><span style="font-family: 'Andale Mono'; ">GET<span class="Apple-tab-span" style="white-space: pre; "> </span>/api/protocol/<VEHICLEID><span class="Apple-tab-span" style="white-space: pre; "> </span>Return raw protocol records (no vehicle connection)</span></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET</font><span class="Apple-tab-span" style="font-family: 'Andale Mono'; white-space: pre; "> </span><font face="Andale Mono">/api/vehicle/<VEHICLEID></font><span class="Apple-tab-span" style="font-family: 'Andale Mono'; white-space: pre; "> </span><font face="Andale Mono">Connect to, and return vehicle information</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space:pre"> </span>/api/vehicle/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Disconnect from vehicle</font></div><div><br></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/status/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle status</font></div></div><div><br></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/tpms/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return toms status</font></div><div><div><br></div></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/location/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle location</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle charge status</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Set vehicle charge status</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space:pre"> </span>/api/charge/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Abort a vehicle charge</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle lock status</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Lock a vehicle</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space:pre"> </span>/api/lock/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Unlock a vehicle</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return valet status</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Enable valet mode</font></div><div><font face="Andale Mono">DELETE<span class="Apple-tab-span" style="white-space:pre"> </span>/api/valet/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Disable valet mode</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/features/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle features</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/feature/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Set a vehicle feature</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/parameters/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Return vehicle parameters</font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/parameter/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Set a vehicle parameter</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/reset/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Reset the module in a particular vehicle</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">PUT<span class="Apple-tab-span" style="white-space:pre"> </span>/api/homelink/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Activate </font><span style="font-family: 'Andale Mono'; ">home link</span></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><font face="Andale Mono"><br></font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/historical/<VEHICLEID><span class="Apple-tab-span" style="white-space:pre"> </span>Request historical data summary</font></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><font face="Andale Mono">GET<span class="Apple-tab-span" style="white-space:pre"> </span>/api/historical/<VEHICLEID>/<DATATYPE><span class="Apple-tab-span" style="white-space:pre"> </span>Request historical data records</font></blockquote><div><div><div><br></div><div>Thoughts / suggestions?</div><div><br></div><div>Regards, Mark.</div><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[Ovmsdev] HTTP API</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">18 February, 2013 9:41:15 AM HKT<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Reply-To: </b></span><span style="font-family:'Helvetica'; font-size:medium;">OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk">ovmsdev@lists.teslaclub.hk</a>><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>For some time now I've wanted to offer an HTTP API for OVMS. The existing car<->server and server<->app protocol is cool, but requires going through some hoops (perl, whatever) to handle the encryption and protocol level stuff. An HTTP API would make this much easier to externally script, and would be great for pulling down logs and other such things.</div><div><br></div><div>I've now completed work re-factoring the ovms_server.pl code to add the framework to support this:</div><div><br></div><div><ol class="MailOutline"><li>Switched to using the AnyEvent::HTTPD cpan module for the base framework.</li><li>Implemented an HTTP server on tcp/6868.</li><li>Implemented an HTTPS server on tcp/6869.</li><li>Support serving of arbitrary files (in httpfiles directory) for HTTP and HTTPS.</li><li>Implemented syncing of Drupal user accounts (and password hashes) to new ovms_owners table.</li><li>Extended the protocol to support syncing owners and well as vehicle records.</li><li>Support syncing ovms_owners table to connected OVMS servers.</li><li>Moved ovms_utilisation to ovms_historicalmessages as type '*-OVM-Utilisation", with records 0 (car_rx), 1 (car_tx), 2 (app_rx) and 3 (app_tx).</li></ol></div><div><br></div><div>The above work has just been PUSHed to github.</div><div><br></div><div>So, the framework exists. Now for the fun stuff.</div><div><br></div><div>My thinking is:</div><div><br></div><div><ul class="MailOutline"><li>Authenticate to a vehicle either by vehicle + serverpass, or OVMS username+password.</li><li>You can get a list of vehicles by providing your OVMS username+password.</li><li>Use cookies to maintain a session - and time sessions out after a few minutes of inactivity (or on demand logout).</li><li>Basic functions to retrieve current vehicle status, and historical data.</li><li>Function to 'connect' to a live vehicle - just like an App, it will keep the connection open for as long as the session lasts, then tell the vehicle you have disconnected.</li><li>Control functions - just like the apps - start/stop charge, homelink, etc.</li><li>Support for OVMS protocol, so can convert the data messages to actual real-world JSON.</li></ul></div><div><br></div><div>Does anyone want to work with me on this? In particular, anyone with RESTful or other HTTP API experience? </div><div><br></div><div>Regards, Mark.</div><div><br></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></div></div>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></blockquote></div><br></div></body></html>