This topic provides instructions for managing outbound HTTP calls in Pivotal Scheduler.
You can use Pivotal Scheduler to schedule execution of HTTP calls to external HTTP services. See the following sections to learn more about creating, running, and scheduling calls and viewing call history.
To use the Cloud Foundry Command Line Interface (cf CLI) for managing calls, you must install the Pivotal Scheduler CLI plugin on your local machine. This plugin is packaged with the Pivotal Scheduler tile on Pivotal Network. For more information, see the Prerequisites section of the Using Pivotal Scheduler topic.
You can create a call by running the
cf create-call APP-NAME CALL-NAME URL command, where:
APP-NAMEis the app you want to create a call for.
CALL-NAMEis the name for your call.
URLis the URL to execute a HTTP POST call against.
You can execute a call manually by running the
cf run-call CALL-NAME command. This is often useful to test the configuration of a call prior to scheduling it for recurring execution.
See the following example:
$ cf run-call my-call
Enqueuing call my-call for app my-app in org my-org / space my-space as firstname.lastname@example.org... OK
Note: Call execution must complete within 10 seconds.
You can schedule a call to execute at any time using a schedule expression. Pivotal Scheduler requires Quartz cron expressions in the
MIN HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK format. For more information on how to use this syntax, see Scheduler Cron Syntax.
For example, to execute a call at noon every day, run the following command:
$ cf schedule-call my-call "0 12 ? * * "
A single call can have multiple schedules. Each schedule has a GUID to distinguish it from similar schedules.
Note: Scheduled calls automatically execute in UTC.
You can use the cf CLI to list all calls in a space by running
cf calls. See the following example:
$ cf calls
Listing calls for org my-org / space my-space as email@example.com... Call Name App Name URL my-call my-app https://example.com OK
You can review schedules for all calls in a space by running
cf call-schedules. See the following example:
$ cf call-schedules
Getting scheduled calls for org my-org / space my-space as firstname.lastname@example.org... App Name: my-app my-call 2b69e0c2-9664-46bb-4817-54afcedbb65d 0 12 ? * * OK
You can review call history by running
cf call-history CALL-NAME. See the following example:
$ cf call-history my-call
Getting scheduled call history for my-call in org my-org / space my-space as email@example.com... 1 - 1 of 1 Total Results Execution GUID Execution State Scheduled Time Execution Start Time Execution End Time Exit Message d288a4ba-e0bc-48c9-969c-6ee79e380b20 SUCCEEDED Mon, 16 Oct 2017 12:10:55 UTC Mon, 16 Oct 2017 12:10:55 UTC Mon, 16 Oct 2017 12:10:55 UTC 201 - Created
You can delete a call by running
cf delete-call CALL-NAME. See the following example:
$ cf delete-call my-call
Really delete the call my-call with url https://example.com and all associated schedules and history?> [yN]:y OK
You can delete a specific schedule by running
cf delete-call-schedule SCHEDULE-GUID, where
SCHEDULE-GUID is the GUID found in the output of the
cf call-schedules command. See the following example:
$ cf delete-call-schedule 2b69e0c2-9664-46bb-4817-54afcedbb65d
Really delete the schedule 2b69e0c2-9664-46bb-4817-54afcedbb65d / 0 12 ? * * and all associated history?> [yN]: y OK