-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
executable file
·44 lines (33 loc) · 1.37 KB
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
/*
A way for plugins to provide their own PHP API endpoints.
To use, create a file called api.php file in the plugin's directory
and provide a getEndpointsPLUGINNAME() function which returns an
array describing the endpoints the plugin implements. Since PHP
does not allow hyphens in function names, any hyphens in the plugin
name must be removed when substituting for PLUGINNAME above and if
the plugin name is used in any callback function names. It is
also best to use unique endpoint names as shown below to eliminate
any conflicts with stock FPP code or other plugin API callbacks.
All endpoints are prefixed with /api/plugin/PLUGIN-NAME but only
the part after PLUGIN-NAME is specified in the getEndpointsPLUGINNAME()
data. The plugin name is used as-is in the endpoint URL, hyphens
are not removed. -- limonade.php is used for the underlying implementation so
param("param1" ) can be used for an api like /api/plugin/fpp-BigButtons/:param1
*/
function getEndpointsfpppluginDynamicPixels() {
$result = array();
$ep = array(
'method' => 'GET',
'endpoint' => 'version',
'callback' => 'fppDynamicPixelsVersion');
array_push($result, $ep);
return $result;
}
// GET /api/plugin/fpp-DynamicPixels/version
function fppDynamicPixelsVersion() {
$result = array();
$result['version'] = 'fpp-DynamicPixels v0.1';
return json($result);
}
?>