[Ovmsdev] HTTP API

Mark Webb-Johnson mark at webb-johnson.net
Mon Feb 18 09:41:15 HKT 2013

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.

I've now completed work re-factoring the ovms_server.pl code to add the framework to support this:

Switched to using the AnyEvent::HTTPD cpan module for the base framework.
Implemented an HTTP server on tcp/6868.
Implemented an HTTPS server on tcp/6869.
Support serving of arbitrary files (in httpfiles directory) for HTTP and HTTPS.
Implemented syncing of Drupal user accounts (and password hashes) to new ovms_owners table.
Extended the protocol to support syncing owners and well as vehicle records.
Support syncing ovms_owners table to connected OVMS servers.
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).

The above work has just been PUSHed to github.

So, the framework exists. Now for the fun stuff.

My thinking is:

Authenticate to a vehicle either by vehicle + serverpass, or OVMS username+password.
You can get a list of vehicles by providing your OVMS username+password.
Use cookies to maintain a session - and time sessions out after a few minutes of inactivity (or on demand logout).
Basic functions to retrieve current vehicle status, and historical data.
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.
Control functions - just like the apps - start/stop charge, homelink, etc.
Support for OVMS protocol, so can convert the data messages to actual real-world JSON.

Does anyone want to work with me on this? In particular, anyone with RESTful or other HTTP API experience? 

Regards, Mark.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20130218/a01c2308/attachment.htm>

More information about the OvmsDev mailing list