NATS5 REST API Maintenance GET logs
From TMM Wiki
(Redirected from NATS4 REST API Maintenance GET logs)
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
GET /maintenance/logs
Description
- Get list of log files
Resource URL
- http://domain/api/maintenance/logs
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
None
Example Request
Method: GET
URL: http://domain/api/maintenance/logs
Response:
{ "success": true, "logs": [ { "name": "BUILD_REPORT_SUMMARY.log", "size": 132848, "size_nice": "129.73 Kb", "lines": "368", "first": "2019-06-10 15:20:34", "last": "2019-08-07 17:52:48" }, { "name": "nats_codecept.bad.log", "size": 0, "size_nice": "0 bytes", "lines": 0, "first": "", "last": "" }, { "name": "RUN_CLEANUP.log", "size": 213897, "size_nice": "208.88 Kb", "lines": "561", "first": "2019-06-10 15:01:57", "last": "2019-08-07 17:52:49" }, { "name": "www.admin_mails.php.log", "size": 107400, "size_nice": "104.88 Kb", "lines": "82", "first": "2019-06-03 12:55:03", "last": "2019-06-12 11:46:44" }, { "name": "www.admin_sites.php.log", "size": 283, "size_nice": "283 bytes", "lines": "1", "first": "2019-06-13 11:06:58", "last": "2019-06-13 11:06:58" }, { "name": "nats_codecept.log", "size": 230835344, "size_nice": "220.14 MB", "lines": "106274", "first": "2019-06-03 12:52:57", "last": "2019-08-09 16:29:09" }, { "name": "tmm_library.PHP_ERRORS.log", "size": 1073741918, "size_nice": "1 GB", "lines": "253208", "first": "2019-04-19 10:38:25", "last": "2019-08-07 17:05:54" }, { "name": "www.includes.transaction_functions.PROCESS_CANCEL.log", "size": 614873, "size_nice": "600.46 Kb", "lines": "1767", "first": "2019-06-05 10:26:40", "last": "2019-08-09 16:28:55" }, { "name": "www.admin_api_rest.php.log", "size": 778, "size_nice": "778 bytes", "lines": "2", "first": "2019-06-03 12:26:56", "last": "2019-06-03 12:27:08" }, { "name": "www.internal.php.log", "size": 7358, "size_nice": "7.19 Kb", "lines": "26", "first": "2019-05-29 10:17:10", "last": "2019-07-26 11:29:44" }, { "name": "www.ADMIN_API_REST.log", "size": 65786605, "size_nice": "62.74 MB", "lines": "172747", "first": "2019-04-19 10:38:24", "last": "2019-07-26 15:58:44" }, { "name": "www.admin_mails.goodsend.php.log", "size": 51020, "size_nice": "49.82 Kb", "lines": "36", "first": "2019-06-03 12:55:03", "last": "2019-06-03 12:55:05" }, { "name": "www.admin_affiliates.php.log", "size": 1415, "size_nice": "1.38 Kb", "lines": "5", "first": "2019-05-30 11:01:16", "last": "2019-05-30 14:02:37" }, { "name": "RUN_MAILS.log", "size": 138344, "size_nice": "135.1 Kb", "lines": "392", "first": "2019-06-03 11:04:13", "last": "2019-08-09 16:29:08" }, { "name": "www.admin_support.php.log", "size": 19240, "size_nice": "18.79 Kb", "lines": "16", "first": "2019-06-03 12:53:19", "last": "2019-06-03 12:56:19" }, { "name": "www.admin_overview.php.log", "size": 4245, "size_nice": "4.15 Kb", "lines": "15", "first": "2019-05-29 10:32:23", "last": "2019-06-13 11:06:51" }, { "name": "www.MEMBER_INSERT.log", "size": 504116, "size_nice": "492.3 Kb", "lines": "865", "first": "2019-06-04 16:19:12", "last": "2019-08-09 16:28:55" }, { "name": "www.admin_logging.php.log", "size": 269360, "size_nice": "263.05 Kb", "lines": "224", "first": "2019-06-03 12:53:21", "last": "2019-06-03 13:03:19" } ] }
Example Code
PHP
<?php $headers = array( //set your username and API key here 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); $url = 'http://yourdomain.com'; //set your NATS URL here $data = array(); $request = Array( 'method' => 'GET', 'path' => 'v1/maintenance/logs', 'data' => $data ); /*code below is the same for (almost) every API call */ $curl = curl_init(); $url = $url.'/api/'.$request['path']; $query = http_build_query($request['data']); if($request['method'] == 'GET'){ //add query string parameters to the end of the url $url = $url.'?'.$query; }else{ //send parameters as POST fields curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $query); if($request['method'] != 'POST'){ $headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>