### GET /jobs Source: https://docs.cron-job.org/rest-api.html Retrieves a list of all cron jobs associated with the authenticated account. ```APIDOC ## GET /jobs ### Description Retrieves a list of all cron jobs present in the user's account. This endpoint is subject to a rate limit of 5 requests per second. ### Method GET ### Endpoint https://api.cron-job.org/jobs ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example curl -X GET \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ https://api.cron-job.org/jobs ### Response #### Success Response (200) - **jobs** (array) - List of job objects - **someFailed** (boolean) - Indicates if some jobs could not be retrieved #### Response Example { "jobs": [ { "jobId": 12345, "enabled": true, "title": "Example Job", "url": "https://example.com/" } ], "someFailed": false } ``` -------------------------------- ### List All Cron Jobs Source: https://docs.cron-job.org/rest-api.html Retrieves a list of all cron jobs associated with the authenticated account using a GET request. ```bash curl -X GET \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ https://api.cron-job.org/jobs ``` -------------------------------- ### GET /jobs//history/ Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Retrieves detailed information for a specific execution history item. ```APIDOC ## GET /jobs//history/ ### Description Retrieve detailed information for a specific history item identified by its identifier. ### Method GET ### Endpoint /jobs//history/ ### Parameters #### Path Parameters - **jobId** (integer) - Required - The unique identifier of the cron job. - **identifier** (string) - Required - The unique identifier of the history item. ### Response #### Success Response (200) - **jobHistoryDetails** (object) - Detailed history item object. #### Response Example { "jobHistoryDetails": { "jobLogId": 4946, "statusText": "OK", "httpStatus": 200 } } ``` -------------------------------- ### GET /history/item-stats Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Retrieves the timing statistics for a specific cron job execution history item. ```APIDOC ## GET /history/item-stats ### Description Retrieves detailed timing information for a job execution history item, measuring performance from name lookup to total transfer time. ### Method GET ### Endpoint /history/item-stats ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier of the history item. ### Request Example GET /history/item-stats?id=12345 ### Response #### Success Response (200) - **nameLookup** (int) - Time from transfer start until name lookups completed (in microseconds) - **connect** (int) - Time from transfer start until socket connect completed (in microseconds) - **appConnect** (int) - Time from transfer start until SSL handshake completed (in microseconds) - **preTransfer** (int) - Time from transfer start until beginning of data transfer (in microseconds) - **startTransfer** (int) - Time from transfer start until the first response byte is received (in microseconds) - **total** (int) - Total transfer time (in microseconds) #### Response Example { "nameLookup": 150, "connect": 300, "appConnect": 500, "preTransfer": 600, "startTransfer": 800, "total": 1200 } ``` -------------------------------- ### GET /jobs/ Source: https://docs.cron-job.org/rest-api.html Retrieves detailed information for a specific cron job identified by its unique ID. ```APIDOC ## GET /jobs/ ### Description Retrieve detailed information for a specific cron job identified by its jobId. ### Method GET ### Endpoint /jobs/ ### Parameters #### Path Parameters - **jobId** (int) - Required - The unique identifier of the cron job. ### Response #### Success Response (200) - **jobDetails** (object) - The detailed configuration and status of the cron job. #### Response Example { "jobDetails": { "jobId": 12345, "enabled": true, "title": "Example Job", "url": "https://example.com/" } } ``` -------------------------------- ### GET /jobs//history/ Source: https://docs.cron-job.org/rest-api.html Retrieves comprehensive details for a specific execution history item, including response headers and body. ```APIDOC ## GET /jobs//history/ ### Description Retrieve details for a specific history item identified by its identifier for a specific cron job. This endpoint returns the full response headers and body. ### Method GET ### Endpoint /jobs//history/ ### Parameters #### Path Parameters - **jobId** (int) - Required - The unique identifier of the cron job. - **identifier** (string) - Required - The unique identifier of the history item. ### Request Example ``` curl -X GET \ -H 'Authorization: Bearer ' \ https://api.cron-job.org/jobs/12345/history/12345-22-11-4946 ``` ### Response #### Success Response (200) - **jobHistoryDetails** (object) - Detailed history item data including headers and body. #### Response Example { "jobHistoryDetails": { "jobLogId": 4946, "headers": "Content-Type: text/html", "body": "..." } } ``` -------------------------------- ### Retrieve Job History Log JSON Schema Source: https://docs.cron-job.org/_sources/rest-api.rst.txt An example JSON object representing the detailed history of a specific cron job execution. It includes metadata such as status codes, timing statistics, and the raw HTTP response body. ```json { "jobHistoryDetails": { "jobLogId": 4946, "jobId": 12345, "identifier": "12345-22-11-4946", "date": 1640189711, "datePlanned": 1640189700, "jitter": 11257, "url": "http:\/\/example.com\/", "duration": 239, "status": 1, "statusText": "OK", "httpStatus": 200, "headers": "Accept-Ranges: bytes\r\nCache-Control: max-age=604800\r\nContent-Type: text\/html; charset=UTF-8...\r\n\r\n", "body": "\n\n\n Example Domain<\/title>...\n", "stats": { "nameLookup": 1003, "connect": 85516, "appConnect": 0, "preTransfer": 85548, "startTransfer": 238112, "total": 238129 } } } ``` -------------------------------- ### GET /jobs/<jobId>/history Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Retrieves the execution history and predicted future executions for a specific cron job. ```APIDOC ## GET /jobs/<jobId>/history ### Description Retrieve the execution history and predicted next executions for a specific cron job. ### Method GET ### Endpoint /jobs/<jobId>/history ### Parameters #### Path Parameters - **jobId** (integer) - Required - The unique identifier of the cron job. ### Response #### Success Response (200) - **history** (array) - List of recent execution history items. - **predictions** (array) - Unix timestamps of predicted next executions. #### Response Example { "history": [ { "jobLogId": 4946, "jobId": 12345, "identifier": "12345-22-11-4946", "date": 1640189711, "status": 1 } ], "predictions": [1640190600, 1640191500] } ``` -------------------------------- ### GET /jobs/<jobId>/history Source: https://docs.cron-job.org/rest-api.html Retrieves the execution history and predicted future execution timestamps for a specific cron job. ```APIDOC ## GET /jobs/<jobId>/history ### Description Retrieve the execution history for a specific cron job identified by its jobId. Note that headers and body fields are not populated in this summary view. ### Method GET ### Endpoint /jobs/<jobId>/history ### Parameters #### Path Parameters - **jobId** (int) - Required - The unique identifier of the cron job. ### Request Example ``` curl -X GET \ -H 'Authorization: Bearer <token>' \ https://api.cron-job.org/jobs/12345/history ``` ### Response #### Success Response (200) - **history** (array) - The last execution history items. - **predictions** (array) - Unix timestamps of the predicted next executions. #### Response Example { "history": [ { "jobLogId": 4946, "jobId": 12345, "statusText": "OK", "httpStatus": 200 } ], "predictions": [1640190600] } ``` -------------------------------- ### Job Configuration Objects Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Definitions for the core configuration objects required for job creation and management. ```APIDOC ## Job Configuration Objects ### JobAuth Represents HTTP basic authentication settings. - **enable** (boolean) - Optional - Whether to enable HTTP basic authentication (Default: false) - **user** (string) - Optional - HTTP basic auth username - **password** (string) - Optional - HTTP basic auth password ### JobNotificationSettings Specifies notification triggers and thresholds. - **onFailure** (boolean) - Optional - Send notification on failure (Default: false) - **onFailureCount** (int) - Optional - Failures required before notification (Default: 1) - **onSuccess** (boolean) - Optional - Send notification on success after failure (Default: false) - **onDisable** (boolean) - Optional - Send notification on auto-disable (Default: false) ### JobExtendedData Extended request data for the cron job. - **headers** (dictionary) - Optional - Request headers (Default: {}) - **body** (string) - Optional - Request body data ### Request Example { "auth": { "enable": true, "user": "admin", "password": "secret" }, "notification": { "onFailure": true, "onFailureCount": 3 }, "extendedData": { "headers": { "Content-Type": "application/json" }, "body": "{\"key\": \"value\"}" } } ``` -------------------------------- ### Job Configuration Objects Source: https://docs.cron-job.org/rest-api.html Definitions for job-related configuration objects including authentication, notifications, and scheduling. ```APIDOC ## JobAuth ### Description Represents HTTP basic authentication settings for a job. ### Fields - **enable** (boolean) - Optional - Whether to enable HTTP basic authentication (default: false) - **user** (string) - Optional - HTTP basic auth username - **password** (string) - Optional - HTTP basic auth password ## JobNotificationSettings ### Description Specifies notification settings for job events. ### Fields - **onFailure** (boolean) - Optional - Send notification on failure (default: false) - **onFailureCount** (int) - Optional - Failures required before notification (min 1, default: 1) - **onSuccess** (boolean) - Optional - Notify on success after prior failure (default: false) - **onDisable** (boolean) - Optional - Notify when job is auto-disabled (default: false) ## JobSchedule ### Description Defines the execution schedule for a job. ### Fields - **timezone** (string) - Optional - Schedule time zone (default: UTC) - **expiresAt** (int) - Optional - Expiration timestamp (YYYYMMDDhhmmss, 0 = no expiry) - **hours** (array of int) - Optional - Execution hours (0-23, [-1] = every hour) - **minutes** (array of int) - Optional - Execution minutes (0-59, [-1] = every minute) - **months** (array of int) - Optional - Execution months (1-12, [-1] = every month) - **wdays** (array of int) - Optional - Days of week (0-6, [-1] = every day) ``` -------------------------------- ### PUT /jobs Source: https://docs.cron-job.org/rest-api.html Creates a new cron job with the provided configuration. ```APIDOC ## PUT /jobs ### Description Creating a new cron job. ### Method PUT ### Endpoint /jobs ### Parameters #### Request Body - **job** (object) - Required - The job configuration object (url is mandatory). ### Response #### Success Response (200) - **jobId** (int) - Identifier of the created job. #### Response Example { "jobId": 12345 } ``` -------------------------------- ### Create a New Cron Job via API Source: https://docs.cron-job.org/rest-api.html Creates a new cron job by sending a PUT request with the job configuration object. The 'url' field is mandatory for the job creation. ```bash curl -X PUT \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ -d '{"job":{"url":"https://example.com","enabled":true,"saveResponses":true,"schedule":{"timezone":"Europe/Berlin","expiresAt":0,"hours":[-1],"mdays":[-1],"minutes":[-1],"months":[-1],"wdays":[-1]}}}' \ https://api.cron-job.org/jobs ``` -------------------------------- ### Job Execution History Source: https://docs.cron-job.org/rest-api.html Definitions for job history logs and associated timing statistics. ```APIDOC ## HistoryItem ### Description Represents a single execution log entry for a cron job. ### Fields - **jobId** (int) - Identifier of the associated cron job - **date** (int) - Unix timestamp of execution - **status** (JobStatus) - Execution status code - **duration** (int) - Duration in milliseconds - **stats** (HistoryItemStats) - Timing information ## HistoryItemStats ### Description Contains granular timing information for a request execution. ### Fields - **nameLookup** (int) - Time for name lookups (microseconds) - **connect** (int) - Time for socket connection (microseconds) - **total** (int) - Total transfer time (microseconds) ``` -------------------------------- ### Listing Cron Jobs Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Retrieves a list of all cron jobs associated with the authenticated account. It returns an array of job objects and a flag indicating if some jobs could not be retrieved. ```APIDOC ## GET /jobs ### Description List all jobs in this account. ### Method GET ### Endpoint https://api.cron-job.org/jobs ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **jobs** (array of Job) - List of jobs present in the account - **someFailed** (boolean) - ``true`` in case some jobs could not be retrieved because of internal errors and the list might be incomplete, otherwise ``false`` #### Response Example ```json { "jobs": [ { "jobId": 12345, "enabled": true, "title": "Example Job", "saveResponses": false, "url": "https:\/\/example.com\/", "lastStatus": 0, "lastDuration": 0 } ], "someFailed": false } ``` ``` -------------------------------- ### Retrieve Cron Job Details via API Source: https://docs.cron-job.org/rest-api.html Fetches detailed configuration and status information for a specific cron job using its unique jobId. Requires a valid Authorization Bearer token. ```bash curl -X GET \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ https://api.cron-job.org/jobs/12345 ``` -------------------------------- ### Retrieve Detailed Cron Job Execution Log Source: https://docs.cron-job.org/rest-api.html Retrieves comprehensive details for a specific execution log entry, including response headers and body content. Requires the jobId and the unique history identifier. ```curl curl -X GET \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ https://api.cron-job.org/jobs/12345/history/12345-22-11-4946 ``` -------------------------------- ### PATCH /jobs/<jobId> Source: https://docs.cron-job.org/_sources/rest-api.rst.txt Updates an existing cron job by providing a delta of the fields to be changed. ```APIDOC ## PATCH /jobs/<jobId> ### Description Updates a cron job identified by its jobId. Only include the fields that need to be changed. ### Method PATCH ### Endpoint /jobs/<jobId> ### Parameters #### Path Parameters - **jobId** (integer) - Required - The unique identifier of the cron job. #### Request Body - **job** (object) - Required - Job delta containing fields to update. ### Request Example { "job": { "enabled": true } } ### Response #### Success Response (200) - **Empty Object** (object) - Indicates successful update. #### Response Example {} ``` -------------------------------- ### Authenticate and Update Cron Job via REST API Source: https://docs.cron-job.org/rest-api.html Demonstrates how to perform a PATCH request to update a cron job's status. Requires an API key in the Authorization header and a JSON-encoded payload. ```bash curl -X PATCH \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ -d '{"job":{"enabled":true}}' \ https://api.cron-job.org/jobs/12345 ``` ```python import json import requests ENDPOINT = 'https://api.cron-job.org' headers = { 'Authorization': 'Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ', 'Content-Type': 'application/json' } payload = { 'job': { 'enabled': True } } result = requests.patch(ENDPOINT + '/jobs/12345', headers=headers, data=json.dumps(payload)) print(result.json()) ``` -------------------------------- ### PATCH /jobs/<jobId> Source: https://docs.cron-job.org/rest-api.html Updates specific fields of an existing cron job. ```APIDOC ## PATCH /jobs/<jobId> ### Description Updating a cron job identified by its jobId. Only include changed fields. ### Method PATCH ### Endpoint /jobs/<jobId> ### Parameters #### Path Parameters - **jobId** (int) - Required - The unique identifier of the cron job. #### Request Body - **job** (object) - Required - The job delta containing fields to update. ### Response #### Success Response (200) - **{}** (object) - Empty object on success. #### Response Example {} ``` -------------------------------- ### Retrieve Cron Job Execution History via API Source: https://docs.cron-job.org/rest-api.html Fetches the execution history and upcoming predicted execution timestamps for a specific cron job. Requires a valid Authorization bearer token. ```curl curl -X GET \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ https://api.cron-job.org/jobs/12345/history ``` -------------------------------- ### Update an Existing Cron Job via API Source: https://docs.cron-job.org/rest-api.html Updates specific fields of an existing cron job using a PATCH request. Only the fields that need to be changed should be included in the request body. ```bash curl -X PATCH \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ -d '{"job":{"enabled":true}}' \ https://api.cron-job.org/jobs/12345 ``` -------------------------------- ### DELETE /jobs/<jobId> Source: https://docs.cron-job.org/rest-api.html Deletes a specific cron job from the system. ```APIDOC ## DELETE /jobs/<jobId> ### Description Deleting a cron job identified by its jobId. ### Method DELETE ### Endpoint /jobs/<jobId> ### Parameters #### Path Parameters - **jobId** (int) - Required - The unique identifier of the cron job. ### Response #### Success Response (200) - **{}** (object) - Empty object on success. #### Response Example {} ``` -------------------------------- ### Delete a Cron Job via API Source: https://docs.cron-job.org/rest-api.html Permanently removes a cron job from the system based on the provided jobId. This operation requires proper authentication. ```bash curl -X DELETE \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer zaX78aqKJuIH4l4RX6njoqADn77MQNJJ' \ https://api.cron-job.org/jobs/12345 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.