Difference between revisions of "NATS5 REST API Maintenance GET logs"
From TMM Wiki
Jump to navigationJump to searchLine 20: | Line 20: | ||
None | None | ||
+ | == '''Example Request''' == | ||
+ | Method: '''GET'''<br/> | ||
+ | URL: <nowiki>http://domain/api/maintenance/logs</nowiki><br/> | ||
+ | |||
+ | Response: | ||
+ | <pre> | ||
+ | { | ||
+ | "success": true, | ||
+ | "logs": [ | ||
+ | { | ||
+ | "name": "nats_codecept.bad.log", | ||
+ | "size": 528846, | ||
+ | "size_nice": "516.45 Kb", | ||
+ | "lines": "447", | ||
+ | "first": "2019-06-03 12:52:57", | ||
+ | "last": "2019-06-03 13:02:49" | ||
+ | }, | ||
+ | { | ||
+ | "name": "www.admin_mails.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": "nats_codecept.log", | ||
+ | "size": 24551290, | ||
+ | "size_nice": "23.41 MB", | ||
+ | "lines": "17176", | ||
+ | "first": "2019-06-03 12:52:57", | ||
+ | "last": "2019-06-07 13:51:34" | ||
+ | }, | ||
+ | { | ||
+ | "name": "tmm_library.PHP_ERRORS.log", | ||
+ | "size": 16825142, | ||
+ | "size_nice": "16.05 MB", | ||
+ | "lines": "9176", | ||
+ | "first": "2019-04-19 10:38:25", | ||
+ | "last": "2019-06-07 13:51:34" | ||
+ | }, | ||
+ | { | ||
+ | "name": "www.includes.transaction_functions.PROCESS_CANCEL.log", | ||
+ | "size": 51060, | ||
+ | "size_nice": "49.86 Kb", | ||
+ | "lines": "148", | ||
+ | "first": "2019-06-05 10:26:40", | ||
+ | "last": "2019-06-07 13:50:11" | ||
+ | }, | ||
+ | { | ||
+ | "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": 3679, | ||
+ | "size_nice": "3.59 Kb", | ||
+ | "lines": "13", | ||
+ | "first": "2019-05-29 10:17:10", | ||
+ | "last": "2019-06-07 10:14:47" | ||
+ | }, | ||
+ | { | ||
+ | "name": "www.ADMIN_API_REST.log", | ||
+ | "size": 27214145, | ||
+ | "size_nice": "25.95 MB", | ||
+ | "lines": "73719", | ||
+ | "first": "2019-04-19 10:38:24", | ||
+ | "last": "2019-06-07 10:17:29" | ||
+ | }, | ||
+ | { | ||
+ | "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": 3884, | ||
+ | "size_nice": "3.79 Kb", | ||
+ | "lines": "11", | ||
+ | "first": "2019-06-03 11:04:13", | ||
+ | "last": "2019-06-03 11:28:16" | ||
+ | }, | ||
+ | { | ||
+ | "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": 3113, | ||
+ | "size_nice": "3.04 Kb", | ||
+ | "lines": "11", | ||
+ | "first": "2019-05-29 10:32:23", | ||
+ | "last": "2019-06-06 11:31:59" | ||
+ | }, | ||
+ | { | ||
+ | "name": "www.MEMBER_INSERT.log", | ||
+ | "size": 117200, | ||
+ | "size_nice": "114.45 Kb", | ||
+ | "lines": "200", | ||
+ | "first": "2019-06-04 16:19:12", | ||
+ | "last": "2019-06-07 13:50:11" | ||
+ | }, | ||
+ | { | ||
+ | "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" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
== '''Example Code''' == | == '''Example Code''' == | ||
Line 33: | Line 168: | ||
$url = 'http://yourdomain.com'; //set your NATS URL here | $url = 'http://yourdomain.com'; //set your NATS URL here | ||
− | $data = array( | + | $data = array(); |
− | |||
− | ); | ||
$request = Array( | $request = Array( | ||
Line 79: | Line 212: | ||
[[Category:NATS4_REST_maintenance_Collection]] | [[Category:NATS4_REST_maintenance_Collection]] | ||
[[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | [[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | ||
+ | [[Category:Autogenerated_Rest_Sample]]<!-- This article has a generated REST API Sample from our unit testing system. Also remove if customizing the wiki article --> |
Revision as of 13:27, 7 June 2019
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": "nats_codecept.bad.log", "size": 528846, "size_nice": "516.45 Kb", "lines": "447", "first": "2019-06-03 12:52:57", "last": "2019-06-03 13:02:49" }, { "name": "www.admin_mails.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": "nats_codecept.log", "size": 24551290, "size_nice": "23.41 MB", "lines": "17176", "first": "2019-06-03 12:52:57", "last": "2019-06-07 13:51:34" }, { "name": "tmm_library.PHP_ERRORS.log", "size": 16825142, "size_nice": "16.05 MB", "lines": "9176", "first": "2019-04-19 10:38:25", "last": "2019-06-07 13:51:34" }, { "name": "www.includes.transaction_functions.PROCESS_CANCEL.log", "size": 51060, "size_nice": "49.86 Kb", "lines": "148", "first": "2019-06-05 10:26:40", "last": "2019-06-07 13:50:11" }, { "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": 3679, "size_nice": "3.59 Kb", "lines": "13", "first": "2019-05-29 10:17:10", "last": "2019-06-07 10:14:47" }, { "name": "www.ADMIN_API_REST.log", "size": 27214145, "size_nice": "25.95 MB", "lines": "73719", "first": "2019-04-19 10:38:24", "last": "2019-06-07 10:17:29" }, { "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": 3884, "size_nice": "3.79 Kb", "lines": "11", "first": "2019-06-03 11:04:13", "last": "2019-06-03 11:28:16" }, { "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": 3113, "size_nice": "3.04 Kb", "lines": "11", "first": "2019-05-29 10:32:23", "last": "2019-06-06 11:31:59" }, { "name": "www.MEMBER_INSERT.log", "size": 117200, "size_nice": "114.45 Kb", "lines": "200", "first": "2019-06-04 16:19:12", "last": "2019-06-07 13:50:11" }, { "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); ?>