HackApi for OpenWRT - Php API client

Hi guys,

I've just released HackApi, a php API client , with an OpenWrt module.
https://github.com/soif/HackApi/

It currently implements 184 methods to interface with the OpenWRT API.

BTW. Because of the lack of a few OpenWRT API documentation, some methods are not currently documented/tested as they should.

So if you like this API client, you are more than welcome to contribute by testing untested endpoints, and add some methods documentation.

PullRequests are always welcome!

Enjoy

Intriguing. So am I understanding it correctly that this facilitates setting up an interface through which you can setup and control multiple devices across different device types? So if I have a Huwaei LTE router acting as a modem and OpenWrt router, I can setup and control both using the common interface?

HackApi aims to be an unified API client.

You can use it only for only one device (ie OpenWrt), or for SOME devices.

Each 'Raw' Api method (per devices), returns a resulting array, depending on the API of each device. Return conventions are the same whatever the device is used:

  • Returns a (cleaned) array of results, if they are valid
  • Returns FALSE on error
  • Returns TRUE, on 'ok' (whatever the original API format says, ie: result->'ok', or error->'0', or response->'done', etc...)

So for basic tasks like Reboot, start/stop services etc... you dont have to bother of the original API format, and simply expect a TRUE,FALSE, or array as the result of any method.

Where it comes a bit more funky, is that when using "Standardised" methods (ie ApiWifiListClients), whatever the device used, the returned array is always formatted with the same KEYS and format.
So that it is very fast and simple to build a script, that ie request all Wifi clients, (of all diifferent devices used), and merge them into a single list...

A bit difficult to explain this with my limited english writing, but try it by yourself....