Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

Commit a85379a

Browse files
committed
updated api
1 parent 3c23b79 commit a85379a

File tree

3 files changed

+125
-125
lines changed

3 files changed

+125
-125
lines changed

apidoc/doc.php

+77-77
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php
22

33

4-
Server::create(WEBROOT.'api', 'RestApi\Auth') //base entry points `/admin`
4+
Server::create(WEBROOT.'api/v1', 'RestApi\Auth') //base entry points `/admin`
55
->setDebugMode(true) //prints the debug trace, line number and file if a exception has been thrown.
66

77
/**
8-
* @api {get} /api/session get current session
8+
* @api {get} /api/v1/session get current session
99
* @apiName get session
1010
* @apiGroup Auth
1111
*
1212
* @apiParam (cookie) {String} HOMERSESSID cookie session id
1313
*
1414
* @apiExample Example usage:
1515
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X GET \
16-
* "http://localhost/api/session"
16+
* "http://localhost/api/v1/session"
1717
*
1818
* @apiSuccessTitle (700) Response
1919
*
@@ -50,10 +50,10 @@
5050
*
5151
**/
5252

53-
->addGetRoute('session', 'getSession') // => /api/session
53+
->addGetRoute('session', 'getSession') // => /api/v1/session
5454

5555
/**
56-
* @api {post} /api/session create a session
56+
* @api {post} /api/v1/session create a session
5757
* @apiName create session
5858
* @apiGroup Auth
5959
*
@@ -62,7 +62,7 @@
6262
* @apiExample Example usage:
6363
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
6464
* -d '{"username":"admin","password":"test123"}' \
65-
* http://localhost/api/session
65+
* http://localhost/api/v1/session
6666
*
6767
* @apiParam {String} username Login for session creation.
6868
* @apiParam {String} password Password for session creation.
@@ -115,17 +115,17 @@
115115

116116

117117

118-
->addPostRoute('session', 'doSession') // => /api/session
118+
->addPostRoute('session', 'doSession') // => /api/v1/session
119119
/*
120-
* @api {delete} /api/session delete current session
120+
* @api {delete} /api/v1/session delete current session
121121
* @apiName delete session
122122
* @apiGroup Auth
123123
*
124124
* @apiParam (cookie) {String} HOMERSESSID cookie session id
125125
*
126126
* @apiExample Example usage:
127127
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X DELETE \
128-
* "http://localhost/api/session"
128+
* "http://localhost/api/v1/session"
129129
*
130130
* @apiSuccessTitle (700) Response
131131
*
@@ -158,15 +158,15 @@
158158

159159
->addDeleteRoute('session', 'doLogout') // => /admin/logout
160160
/**
161-
* @api {get} /api/logout delete current session
161+
* @api {get} /api/v1/logout delete current session
162162
* @apiName logout of session
163163
* @apiGroup Auth
164164
*
165165
* @apiParam (cookie) {String} HOMERSESSID cookie session id
166166
*
167167
* @apiExample Example usage:
168168
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X GET \
169-
* "http://localhost/api/logout"
169+
* "http://localhost/api/v1/logout"
170170
*
171171
* @apiSuccessTitle (700) Response
172172
*
@@ -201,7 +201,7 @@
201201

202202
->addSubController('search', 'RestApi\Search') //adds a new sub entry point 'tools' => admin/tools
203203
/**
204-
* @api {post} /api/search/data do search
204+
* @api {post} /api/v1/search/data do search
205205
* @apiName search data
206206
* @apiGroup Search
207207
*
@@ -210,7 +210,7 @@
210210
* @apiExample Example usage:
211211
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
212212
* -d '{"param":{"transaction":{"call":true},"limit":200,"search":{"ruri_user":"108"},"node":[{"id":"1","name":"homer01"}]},"timestamp":{"from":1433521859738,"to":1433529659738}}' \
213-
* http://localhost/api/search/data
213+
* http://localhost/api/v1/search/data
214214
*
215215
* @apiParam {String[]} timestamp array
216216
* @apiParam {Number} timestamp.from search from this time
@@ -372,9 +372,9 @@
372372
**/
373373

374374

375-
->addPostRoute('data', 'doSearchData') // => /api/session
375+
->addPostRoute('data', 'doSearchData') // => /api/v1/session
376376
/**
377-
* @api {post} /api/search/method method by id
377+
* @api {post} /api/v1/search/method method by id
378378
* @apiName search method
379379
* @apiGroup Search
380380
*
@@ -383,7 +383,7 @@
383383
* @apiExample Example usage:
384384
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
385385
* -d '{"timestamp":{"from":1433529542283,"to":1433529542283},"param":{"search":{"id":14588,"callid":"426690302"},"location":{"node":"single"},"transaction":{"call":true,"registration":false,"rest":false}}}' \
386-
* http://localhost/api/search/method
386+
* http://localhost/api/v1/search/method
387387
*
388388
* @apiParam {String[]} timestamp array
389389
* @apiParam {Number} timestamp.from search from this time
@@ -521,9 +521,9 @@
521521
**/
522522

523523

524-
->addPostRoute('method', 'doSearchMethod') // => /api/session
524+
->addPostRoute('method', 'doSearchMethod') // => /api/v1/session
525525
/**
526-
* @api {post} /api/search/message message by callid
526+
* @api {post} /api/v1/search/message message by callid
527527
* @apiName search message(s)
528528
* @apiGroup Search
529529
*
@@ -532,7 +532,7 @@
532532
* @apiExample Example usage:
533533
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
534534
* -d '{"timestamp":{"from":1433529542283,"to":1433529542283},"param":{"search":{"id":14588,"callid":"426690302"},"location":{"node":"single"},"transaction":{"call":true,"registration":false,"rest":false}}}' \
535-
* http://localhost/api/search/message
535+
* http://localhost/api/v1/search/message
536536
*
537537
* @apiParam {String[]} timestamp array
538538
* @apiParam {Number} timestamp.from search from this time
@@ -670,9 +670,9 @@
670670
* }
671671
**/
672672

673-
->addPostRoute('message', 'doSearchMessage') // => /api/session
673+
->addPostRoute('message', 'doSearchMessage') // => /api/v1/session
674674
/**
675-
* @api {post} /api/search/transaction search trasaction
675+
* @api {post} /api/v1/search/transaction search trasaction
676676
* @apiName search transaction(s)
677677
* @apiGroup Search
678678
*
@@ -681,7 +681,7 @@
681681
* @apiExample Example usage:
682682
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
683683
* -d '{"timestamp":{"from":1433529545834,"to":1433529659738},"param":{"search":{"id":14600,"callid":["[email protected]"]},"location":{"node":[]},"transaction":{"call":true,"registration":false,"rest":false}}}' \
684-
* http://localhost/api/search/transaction
684+
* http://localhost/api/v1/search/transaction
685685
*
686686
* @apiParam {String[]} timestamp array
687687
* @apiParam {Number} timestamp.from search from this time
@@ -800,13 +800,13 @@
800800
* }
801801
**/
802802

803-
->addPostRoute('transaction', 'doSearchTransaction') // => /api/session
804-
->addPostRoute('sharelink', 'doShareLink') // => /api/session
805-
->addPostRoute('share/transaction', 'doSearchShareTransaction') // => /api/session
806-
->addPostRoute('share/export/pcap', 'doPcapExportById') // => /api/session
807-
->addPostRoute('share/export/text', 'doTextExportById') // => /api/session
803+
->addPostRoute('transaction', 'doSearchTransaction') // => /api/v1/session
804+
->addPostRoute('sharelink', 'doShareLink') // => /api/v1/session
805+
->addPostRoute('share/transaction', 'doSearchShareTransaction') // => /api/v1/session
806+
->addPostRoute('share/export/pcap', 'doPcapExportById') // => /api/v1/session
807+
->addPostRoute('share/export/text', 'doTextExportById') // => /api/v1/session
808808
/**
809-
* @api {post} /api/search/export/pcap pcap export
809+
* @api {post} /api/v1/search/export/pcap pcap export
810810
* @apiName pcap of transaction
811811
* @apiGroup Search
812812
*
@@ -815,7 +815,7 @@
815815
* @apiExample Example usage:
816816
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
817817
* -d '{"timestamp":{"from":1433529545834,"to":1433529659738},"param":{"search":{"id":14600,"callid":["[email protected]"]},"location":{"node":[]},"transaction":{"call":true,"registration":false,"rest":false}}}' \
818-
* http://localhost/api/search/export/pcap
818+
* http://localhost/api/v1/search/export/pcap
819819
*
820820
* @apiParam {String[]} timestamp array
821821
* @apiParam {Number} timestamp.from search from this time
@@ -855,9 +855,9 @@
855855
**/
856856

857857

858-
->addPostRoute('export/pcap', 'doPcapExport') // => /api/session
858+
->addPostRoute('export/pcap', 'doPcapExport') // => /api/v1/session
859859
/**
860-
* @api {post} /api/search/export/text text export
860+
* @api {post} /api/v1/search/export/text text export
861861
* @apiName text of transaction
862862
* @apiGroup Search
863863
*
@@ -866,7 +866,7 @@
866866
* @apiExample Example usage:
867867
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
868868
* -d '{"timestamp":{"from":1433529545834,"to":1433529659738},"param":{"search":{"id":14600,"callid":["[email protected]"]},"location":{"node":[]},"transaction":{"call":true,"registration":false,"rest":false}}}' \
869-
* http://localhost/api/search/export/text
869+
* http://localhost/api/v1/search/export/text
870870
*
871871
* @apiParam {String[]} timestamp array
872872
* @apiParam {Number} timestamp.from search from this time
@@ -907,9 +907,9 @@
907907

908908

909909

910-
->addPostRoute('export/text', 'doTextExport') // => /api/session
910+
->addPostRoute('export/text', 'doTextExport') // => /api/v1/session
911911
/**
912-
* @api {post} /api/search/export/data/pcap pcap export of messages
912+
* @api {post} /api/v1/search/export/data/pcap pcap export of messages
913913
* @apiName pcap export of messages
914914
* @apiGroup Search
915915
*
@@ -918,7 +918,7 @@
918918
* @apiExample Example usage:
919919
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
920920
* -d '{"param":{"transaction":{"call":true},"limit":200,"search":{"ruri_user":"108"},"node":[{"id":"1","name":"homer01"}]},"timestamp":{"from":1433521859738,"to":1433529659738}}' \
921-
* http://localhost/api/search/export/data/pcap
921+
* http://localhost/api/v1/search/export/data/pcap
922922
*
923923
* @apiParam {String[]} timestamp array
924924
* @apiParam {Number} timestamp.from search from this time
@@ -980,9 +980,9 @@
980980
* }
981981
**/
982982

983-
->addPostRoute('export/data/pcap', 'doPcapExportData') // => /api/session
983+
->addPostRoute('export/data/pcap', 'doPcapExportData') // => /api/v1/session
984984
/**
985-
* @api {post} /api/search/export/data/text text export of messages
985+
* @api {post} /api/v1/search/export/data/text text export of messages
986986
* @apiName text export of messages
987987
* @apiGroup Search
988988
*
@@ -991,7 +991,7 @@
991991
* @apiExample Example usage:
992992
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X POST -H "Content-Type: application/json" \
993993
* -d '{"param":{"transaction":{"call":true},"limit":200,"search":{"ruri_user":"108"},"node":[{"id":"1","name":"homer01"}]},"timestamp":{"from":1433521859738,"to":1433529659738}}' \
994-
* http://localhost/api/search/export/data/text
994+
* http://localhost/api/v1/search/export/data/text
995995
*
996996
* @apiParam {String[]} timestamp array
997997
* @apiParam {Number} timestamp.from search from this time
@@ -1053,9 +1053,9 @@
10531053
* }
10541054
**/
10551055

1056-
->addPostRoute('export/data/text', 'doTextExportData') // => /api/session
1056+
->addPostRoute('export/data/text', 'doTextExportData') // => /api/v1/session
10571057
/**
1058-
* @api {get} /api/search/data get search
1058+
* @api {get} /api/v1/search/data get search
10591059
* @apiName get search data
10601060
* @apiGroup Search
10611061
*
@@ -1064,7 +1064,7 @@
10641064
* @apiExample Example usage:
10651065
* curl -v --cookie "HOMERSESSID=tcuass65ejl2lifoopuuurpmq7; path=/" -X GET -H "Content-Type: application/json" \
10661066
* -d '{"param":{"transaction":{"call":true},"limit":200,"node":[{"id":"1","name":"homer01"}]},"timestamp":{"from":1433521859738,"to":1433529659738}}' \
1067-
* http://localhost/api/search/data
1067+
* http://localhost/api/v1/search/data
10681068
*
10691069
* @apiParam {String[]} timestamp array
10701070
* @apiParam {Number} timestamp.from search from this time
@@ -1198,66 +1198,66 @@
11981198
* }
11991199
**/
12001200

1201-
->addGetRoute('data', 'getSearchData') // => /api/session
1201+
->addGetRoute('data', 'getSearchData') // => /api/v1/session
12021202
->done()
12031203

12041204
/* statistic */
12051205
->addSubController('statistic', 'RestApi\Statistic') //adds a new sub entry point 'tools' => admin/tools
1206-
->addGetRoute('method', 'getStatisticMethod') // => /api/session
1207-
->addPostRoute('method', 'doStatisticMethod') // => /api/session
1208-
->addPostRoute('data', 'doStatisticData') // => /api/session
1209-
->addGetRoute('data', 'getStatisticData') // => /api/session
1210-
->addPostRoute('ip', 'doStatisticIP') // => /api/session
1211-
->addGetRoute('ip', 'getStatisticIP') // => /api/session
1212-
->addPostRoute('useragent', 'doStatisticUserAgent') // => /api/session
1213-
->addGetRoute('useragent', 'getStatisticUserAgent') // => /api/session
1206+
->addGetRoute('method', 'getStatisticMethod') // => /api/v1/session
1207+
->addPostRoute('method', 'doStatisticMethod') // => /api/v1/session
1208+
->addPostRoute('data', 'doStatisticData') // => /api/v1/session
1209+
->addGetRoute('data', 'getStatisticData') // => /api/v1/session
1210+
->addPostRoute('ip', 'doStatisticIP') // => /api/v1/session
1211+
->addGetRoute('ip', 'getStatisticIP') // => /api/v1/session
1212+
->addPostRoute('useragent', 'doStatisticUserAgent') // => /api/v1/session
1213+
->addGetRoute('useragent', 'getStatisticUserAgent') // => /api/v1/session
12141214
->done()
12151215

12161216
/* alarm */
12171217
->addSubController('alarm', 'RestApi\Alarm') //adds a new sub entry point 'tools' => admin/tools
1218-
->addGetRoute('config/get', 'getAlarmConfig') // => /api/session
1219-
->addPostRoute('config/new', 'doNewAlarmConfig') // => /api/session
1220-
->addPostRoute('config/edit', 'doEditAlarmConfig') // => /api/session
1218+
->addGetRoute('config/get', 'getAlarmConfig') // => /api/v1/session
1219+
->addPostRoute('config/new', 'doNewAlarmConfig') // => /api/v1/session
1220+
->addPostRoute('config/edit', 'doEditAlarmConfig') // => /api/v1/session
12211221
->addDeleteRoute('config/delete/([0-9]+)', 'deleteAlarmConfig')
1222-
->addGetRoute('list/get', 'getAlarmList') // => /api/session
1223-
->addPostRoute('list/edit', 'doEditAlarmList') // => /api/session
1224-
->addGetRoute('method', 'getAlarmMethod') // => /api/session
1225-
->addPostRoute('method', 'doAlarmMethod') // => /api/session
1226-
->addPostRoute('ip', 'doAlarmIP') // => /api/session
1227-
->addGetRoute('ip', 'getAlarmIP') // => /api/session
1228-
->addPostRoute('useragent', 'doAlarmUserAgent') // => /api/session
1229-
->addGetRoute('useragent', 'getAlarmUserAgent') // => /api/session
1222+
->addGetRoute('list/get', 'getAlarmList') // => /api/v1/session
1223+
->addPostRoute('list/edit', 'doEditAlarmList') // => /api/v1/session
1224+
->addGetRoute('method', 'getAlarmMethod') // => /api/v1/session
1225+
->addPostRoute('method', 'doAlarmMethod') // => /api/v1/session
1226+
->addPostRoute('ip', 'doAlarmIP') // => /api/v1/session
1227+
->addGetRoute('ip', 'getAlarmIP') // => /api/v1/session
1228+
->addPostRoute('useragent', 'doAlarmUserAgent') // => /api/v1/session
1229+
->addGetRoute('useragent', 'getAlarmUserAgent') // => /api/v1/session
12301230
->done()
12311231

12321232
/* report */
12331233
->addSubController('report', 'RestApi\Report') //adds a new sub entry point 'tools' => admin/tools
1234-
->addPostRoute('rtcp', 'doRTCPReport') // => /api/session
1235-
->addPostRoute('log', 'doLogReport') // => /api/session
1236-
->addPostRoute('quality/([A-Za-z]+)', 'doQualityReport') // => /api/session
1234+
->addPostRoute('rtcp', 'doRTCPReport') // => /api/v1/session
1235+
->addPostRoute('log', 'doLogReport') // => /api/v1/session
1236+
->addPostRoute('quality/([A-Za-z]+)', 'doQualityReport') // => /api/v1/session
12371237
->done()
12381238

12391239
/* admin */
12401240
->addSubController('admin', 'RestApi\Admin') //adds a new sub entry point 'tools' => admin/tools
1241-
->addGetRoute('user/get', 'getUser') // => /api/session
1242-
->addGetRoute('user/get/([0-9A-Za-z_])', 'getUserById') // => /api/session
1243-
->addPostRoute('user/new', 'doNewUser') // => /api/session
1244-
->addPostRoute('user/edit', 'doEditUser') // => /api/session
1241+
->addGetRoute('user/get', 'getUser') // => /api/v1/session
1242+
->addGetRoute('user/get/([0-9A-Za-z_])', 'getUserById') // => /api/v1/session
1243+
->addPostRoute('user/new', 'doNewUser') // => /api/v1/session
1244+
->addPostRoute('user/edit', 'doEditUser') // => /api/v1/session
12451245
->addDeleteRoute('user/delete/([0-9]+)', 'deleteUser')
12461246

12471247
/* alias */
1248-
->addGetRoute('alias/get', 'getAlias') // => /api/session
1249-
->addGetRoute('user/get/([0-9A-Za-z_])', 'getAliasById') // => /api/session
1250-
->addPostRoute('alias/new', 'doNewAlias') // => /api/session
1251-
->addPostRoute('alias/edit', 'doEditAlias') // => /api/session
1248+
->addGetRoute('alias/get', 'getAlias') // => /api/v1/session
1249+
->addGetRoute('user/get/([0-9A-Za-z_])', 'getAliasById') // => /api/v1/session
1250+
->addPostRoute('alias/new', 'doNewAlias') // => /api/v1/session
1251+
->addPostRoute('alias/edit', 'doEditAlias') // => /api/v1/session
12521252
->addDeleteRoute('user/delete/([0-9]+)', 'deleteAlias')
12531253
/* nodes */
1254-
->addGetRoute('node/get', 'getNode') // => /api/session
1255-
->addGetRoute('node/get/([0-9A-Za-z_])', 'getNodeById') // => /api/session
1256-
->addPostRoute('node/new', 'doNewNode') // => /api/session
1257-
->addPostRoute('node/edit', 'doEditNode') // => /api/session
1254+
->addGetRoute('node/get', 'getNode') // => /api/v1/session
1255+
->addGetRoute('node/get/([0-9A-Za-z_])', 'getNodeById') // => /api/v1/session
1256+
->addPostRoute('node/new', 'doNewNode') // => /api/v1/session
1257+
->addPostRoute('node/edit', 'doEditNode') // => /api/v1/session
12581258
->addDeleteRoute('node/delete/([0-9]+)', 'deleteNode')
12591259
/* alarms */
1260-
->addGetRoute('useragent', 'getAlarmUserAgent') // => /api/session
1260+
->addGetRoute('useragent', 'getAlarmUserAgent') // => /api/v1/session
12611261
->done()
12621262

12631263

0 commit comments

Comments
 (0)