Description

View the latest 10 execution logs of a cron job.

Arguments

token (Required)
You API token. Check authentication section for details.
id (Required)
ID of the cron job you want to get logs.

Example Request

https://www.easycron.com/rest/logs?token=[token]&id=2107

In above example, [token] should be replaced with the true token string.

Example Success Response (in JSON format)

{"status":"success","logs":[{"cron_job_id":"3801","scheduled_time":"2012-08-12 23:28:00","fire_time":"2012-08-12 23:28:03","done_time":"2012-08-12 23:28:03","execute_time":"0.508","http_code":"200","total_time":"0.509","truncated_output":"HTTP\/1.1 200 OK\r\nDate: Sun, 12 Aug 2012 15:28:02 GMT\r\nServer: Apache\/2.2.3 (CentOS)\r\nX-Powered-By: PHP\/5.2.17\r\nSet-Cookie: PHPSESSID=mh61fe968296o56uhmnofsf214; path=\/\r\nExpires: Thu, 19 Nov 1981 08:52:00 GMT\r\nCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\nPragma: no-cache\r\nVary: Accept-Encoding,User-Agent\r\nTransfer-Encoding: chunked\r\nContent-Type: text\/html; charset=UTF-8\r\n\r\n<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\r\n<head><\/head>\r\n<body>Cron Job Done.\r\n<\/body>\r\n<\/html>"}]}

Above example response is equal to the following array:

Array
(
    [status] => success
    [logs] => Array
        (
            [0] => Array
                (
                    [cron_job_id] => 3801
                    [scheduled_time] => 2012-08-12 23:28:00
                    [fire_time] => 2012-08-12 23:28:03
                    [done_time] => 2012-08-12 23:28:03
                    [execute_time] => 0.508
                    [http_code] => 200
                    [total_time] => 0.509
                    [truncated_output] => HTTP/1.1 200 OK
Date: Sun, 12 Aug 2012 15:28:02 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.17
Set-Cookie: PHPSESSID=mh61fe968296o56uhmnofsf214; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding,User-Agent
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
Cron Job Done.
</body>
</html>
                )

        )

)
        

Example Error Response (in JSON format)

If you use an invalid token, you may receive following error response:

{"status":"error","error":{"code":"1","message":"Wrong API token."}}

The equal readable array is:

Array
(
    [status] => error
    [error] => Array
        (
            [code] => 1
            [message] => Wrong API token.
        )

)

If there is something wrong with the arguments, you may receive other error:

code: 25

message: The cron job ID is invalid.

If you make too much API requests in one day, you may receive following error:

code: 26

message: You have exceeded your max daily API request limit.