Api Reference > Cron Job

Cron Job

Table of contents

Using Postman

If you use Postman you can click the following button to import the Looper API as a collection:

getList all Cron Jobs

Endpoint:

https://api.looper.works/v1/cron-jobs

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Response:

{
    "links": {
        "self": "https://api.looper.works/v1/cron-jobs"
    },
    "data": [
        {
            "type": "cronJob",
            "id": "7rWb1B2r1DBx",
            "links": {
                "self": "https://api.looper.works/v1/cron-jobs/7rWb1B2r1DBx"
            },
            "attributes": {
                ...
            }
        },
		...
    ]
}

getRetrieve a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs/{cronJobId}

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Response:

{
    "links": {
        "index": "https://api.looper.works/v1/cron-jobs"
    },
    "data": {
        "type": "cronJob",
        "id": "{cronJobId}",
        "links": {
            "self": "https://api.looper.local/v1/cron-jobs/{cronJobId}"
        },
        "attributes": {
            "name": "Website Heartbeat",
            "url": "https://example.com/api/webhooks/looper/heartbeat",
            "method": "get",
            "status": "enabled",
            "payload": "{}",
            "ssl_verify": false,
            "auth": false,
            "auth_credentials": {
                "user": "",
                "password": ""
            },
            "headers": [
				{
                    "key": "ExampleHeader",
                    "value": "ExampleValue"
                }
			],
            "frequency": "*/1 * * * *",
            "timezone": "Europe/Berlin",
            "disabled_at": null,
            "created_at": "2018-02-11T14:43:33+00:00",
            "updated_at": "2018-02-11T14:50:13+00:00"
        }
    }
}

postCreate a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Attributes:

Name Type Description
name string (required)
url url (required)
method string (required) Can be post or get
frequency cron expression (required) The min interval depends on the account plan
timezone timezone (required)
payload json string
headers array
ssl_verify boolean (required)
auth boolean (required)
auth_user string (required if auth is true)
auth_password string (required if auth is true)

Response:

{
    "links": {
        "index": "https://api.looper.works/v1/cron-jobs"
    },
    "data": {
        "type": "cronJob",
        "id": "{cronJobId}",
        "links": {
            "self": "https://api.looper.local/v1/cron-jobs/{cronJobId}"
        },
        "attributes": {
            "name": "Website Heartbeat",
            "url": "https://example.com/api/webhooks/looper/heartbeat",
            "method": "get",
            "payload": "{}",
            "status": "not_executed_yet",
            "ssl_verify": false,
            "auth": false,
            "auth_credentials": {
                "user": "",
                "password": ""
            },
            "headers": [
				{
                    "key": "ExampleHeader",
                    "value": "ExampleValue"
                }
			],
            "frequency": "*/1 * * * *",
            "timezone": "Europe/Berlin",
            "disabled_at": null,
            "created_at": "2018-02-11T14:43:33+00:00",
            "updated_at": "2018-02-11T14:50:13+00:00"
        }
    }
}

putUpdate a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs/{cronJobId}

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Attributes:

Name Type Description
name string (required)
url url (required)
method string (required) Can be post or get
frequency cron expression (required) The min interval depends on the account plan
timezone timezone (required)
payload json string
headers array
ssl_verify boolean (required)
auth boolean (required)
auth_user string (required if auth is true)
auth_password string (required if auth is true)

Response:

{
    "links": {
        "index": "https://api.looper.works/v1/cron-jobs"
    },
    "data": {
        "type": "cronJob",
        "id": "{cronJobId}",
        "links": {
            "self": "https://api.looper.local/v1/cron-jobs/{cronJobId}"
        },
        "attributes": {
            "name": "Website Heartbeat",
            "url": "https://example.com/api/webhooks/looper/heartbeat",
            "method": "get",
            "payload": "{}",
            "status": "enabled",
            "ssl_verify": false,
            "auth": false,
            "auth_credentials": {
                "user": "",
                "password": ""
            },
            "headers": [
				{
                    "key": "ExampleHeader",
                    "value": "ExampleValue"
                }
			],
            "frequency": "*/1 * * * *",
            "timezone": "Europe/Berlin",
            "disabled_at": null,
            "created_at": "2018-02-11T14:43:33+00:00",
            "updated_at": "2018-02-11T14:50:13+00:00"
        }
    }
}

deleteDelete a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs/{cronJobId}

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Response:

{
    "code": 200,
    "message": "Cron Job deleted."
}

Error Response:

{
    "code": 404,
    "message": "Not Found",
    "errors": []
}

patchEnable a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs/{CronJobId}/enable

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Response:

{
    "code": 200,
    "message": "Cron job enabled."
}

Error Response:

{
    "code": 422,
    "message": "The cron job is already active",
    "errors": []
}

patchDisable a Cron Job

Endpoint:

https://api.looper.works/v1/cron-jobs/{cronJobId}/disable

Headers:

Key Value Description
Authorization Api Access Token You can create these in your dashboard
Content-Type application/json

Response:

{
    "code": 200,
    "message": "Cron job disables."
}

Error Response:

{
    "code": 422,
    "message": "The cron job is already disabled",
    "errors": []
}