Schedule Snapshot Job Methods
Base URL
You can schedule a job to take snapshots at regular intervals for any mashable or mashup. Use the Business Analytics REST URL to run the specific mashable or mashup as the base URL to schedule a job. You can find this URL in the Technical Specs tab on the artifact page for any mashables or mashup.
Include input parameters, if any, for the mashable or mashup in the URL and any other Business Analytics headers, as needed.
Then add the x-p-enableSnapshot and x-p-snapshotName parameters. For example:
http://app-server:port/mashzone/edge/api/rest/service/operation?service-params-if-any&x-p-enableSnapshot=true&x-p-snapshotName=name-or-uuid
To this base URL you add appropriate Parameters that define the schedule for the jobs.
Important: | It is a best practice to limit snapshot schedules to a specific number of repetitions, although this is not required. Open-ended schedules can have a negative impact on performance. |
See Schedule Examples for some combinations of these parameters.
Parameters
You must specify the schedule for the job and any additional parameters required for that type of schedule.
Parameter | Req? | Description |
x-p-enableSnapshot | yes | Determines that this invocation is to create a scheduled job. |
x-p-snapshotName | yes | Choose either: ![*](bullet.gif) A single name to assign to all snapshots taken by this job. uuid, to have Business Analytics automatically assign a unique ID to each snapshot for this job. |
x-p-scheduler | yes | The type of schedule for this job. Valid schedule types include: secondly = schedule every second. Or schedule every number of seconds defined in x-p-repeatinterval with a schedule termination in x-p-repeatcount. minutely = schedule every minute. Or schedule every number of minutes defined in x-p-repeatinterval with a schedule termination in x-p-repeatcount. hourly = schedule every hour. Or schedule every number of hours defined in x-p-repeatinterval with a schedule termination in x-p-repeatcount. daily = schedule every day at a specific time. You must include the x-p-hour and x-p-minute parameters with a schedule of this type. weekly = once a week, on a specific day of the week at a specific time. You must include the x-p-dow, x-p-hour and x-p-minute parameters with a schedule of this type. monthly = once a month, on a specific day at a specific time. You must include the x-p-dom, x-p-hour and x-p-minute parameters with a schedule of this type. |
x-p-hour | | The hour, from 0 to 23, to run a daily, weekly or monthly scheduled job. You must also add the x-p-minute parameter. |
x-p-minute | | The minute to run a daily, weekly or monthly scheduled job. You must also add the x-p-hour parameter. |
x-p-dow | | The day of the week, from 1-7 beginning on Sunday, to run a weekly scheduled job. You must also add the x-p-hour and x-p-minute parameters. |
x-p-dom | | The day of the month (1-31) to run a monthly scheduled job. You must also add the x-p-hour and x-p-minute parameters. |
x-p-repeatcount | | The maximum number of scheduled snapshots to take for this scheduled job. You must also use the x-p-repeatinterval parameter. Tip: | Is it highly recommended to include this optional parameter in job schedules that use second, minute or hourly intervals to define a termination point for the job. |
|
x-p-repeatinterval | | The number of time measurements between each scheduled snapshot for a scheduled job. The actual time measurement is defined by the value of the x-p-scheduler parameter, such as hourly. You must also specify the x-p-repeatcount parameter to define a limit for the schedule. |
Schedule Examples
These examples all use the sample mashable Yahoo Weather Given Zipcode which is a REST mashable that takes a single input parameter, p, with a zip code:
![*](bullet.gif)
Schedule jobs every 3 hours for a 24 hour period:
http://localhost:8080/mashzone/edge/api/rest/YahooWeatherREST/getData?p=98106&x-p-enableSnapshot&x-p-snapshotName=uuid&x-p-scheduler=hourly&x-p-repeatinterval=3&x-p-repeatcount=8
![*](bullet.gif)
Schedule a job on Wednesday each week at 6:00p.m., with no termination:
http://localhost:8080/mashzone/edge/api/rest/YahooWeatherREST/getData?p=98106&x-p-enableSnapshot&x-p-snapshotName=uuid&x-p-scheduler=weekly&x-p-dow=4&x-p-hour=18&x-p-minute=0