Get scheduled requests

GET method to view the list of scheduled cloud provisioning requests.

Method URL Description
GET https://host_name:port/platform/rest/hostfactory/scheduleddemandrequests Gets a list of scheduled requests that are submitted to the HostFactory service.

Prerequisite

You must be the cluster administrator, a read-only cluster administrator, or your user account must be assigned the HF_ALL_REQUESTOR_VIEW permission.

Request

GET https://host_name:port/platform/rest/hostfactory/scheduleddemandrequests?parameters
Parameter Type Required/Optional Description
reqName String Optional Name of the requestor. To view requests for multiple requestors, specify a comma-separated list of requestor names (for example, reqName=symA,symB).
status String Optional Status of the scheduled request. Valid request status are:
  • Created: A request to schedule the cloud request instance is successfully submitted to HostFactory.
  • Active: The scheduled request is active at this time.
  • Closing: The scheduled request is being closed. During this time, the request instances by this request may or may not be closed, depending on whether the close_instances parameter is true or false.
  • Closed: Depending on whether the close_instances parameter is true or false, the scheduled request is marked as Closed under these conditions:
    • If close_instances=true, requests will be marked as Closed if any of these are true:
      • Request is in Closing state and all ongoing request instances are closed.
      • Scheduled request completes its full schedule and the last request instance has closed.
    • If close_instances=false, requests will be marked as Closed if any of these are true:
      • Request in Closing state goes to Closed state (even if a request instances is not closed)
      • Scheduled request completes its full schedule and the last request instance was submitted.
To view scheduled requests in multiple status, specify a comma-separated list of status (for example, status=Created,Active,Closing,Closed).
requestId String Optional ID of the scheduled request. To view hosts provisioned for multiple request IDs, specify a comma-separated list of request IDs (for example, &requestId=1114,1115).
requestName String Optional Name of the scheduled request. To view hosts provisioned with specific request names, specify a comma-separated list of request names (for example, &requestName=AppA,AppB).
createTime String Optional The date and time at which the scheduled request was submitted, represented as a number of seconds since Linux® epoch (January 1 1970 00:00:00).
  • To view requests submitted within a specific duration, specify the start time and end time of the interval, separated by a comma (for example, &createTime=10000,20000).
  • To view requests submitted at a specific time, specify the start time and end time, separated by a comma, to be the same value (for example, &createTime=10000,10000).
startTimeOfFirstDemand Number Optional The date and time at which the first request instance by the scheduled request was scheduled to start, represented as a number of seconds since Linux epoch (January 1 1970 00:00:00).
  • To view requests submitted within a specific duration, specify the start time and end time of the interval, separated by a comma (for example, &startTimeOfFirstDemand=10000,20000).
  • To view requests submitted at a specific time, specify the start time and end time, separated by a comma, to be the same value (for example, &startTimeOfFirstDemand=10000,10000).
lastSubmittedTime Number Optional The date and time at which the last request instance by the scheduled request was scheduled to start, represented as a number of seconds since Linux epoch (January 1 1970 00:00:00).
  • To view requests submitted within a specific duration, specify the start time and end time of the interval, separated by a comma (for example, &lastSubmittedTime=10000,20000).
  • To view requests submitted at a specific time, specify the start time and end time, separated by a comma, to be the same value (for example, &lastSubmittedTime=10000,10000).
nextSubmissionTime Number Optional The date and time at which the next request instance by the scheduled request will be scheduled to start, represented as a number of seconds since Linux epochs (January 1 1970 00:00:00).
  • To view requests submitted within a specific duration, specify the start time and end time of the interval, separated by a comma (for example, &nextSubmissionTime=10000,20000).
  • To view requests submitted at a specific time, specify the start time and end time, separated by a comma, to be the same value (for example, &nextSubmissionTime=10000,10000).
hfcsrftoken string Optional CSRF token that is obtained with successful login.
sortBy String Optional Field name by which data must be sorted, which could be: reqName, requestName, requestId, requestComments, status, createTime, startTimeOfFirstDemand, lastSubmittedTime, nextSubmissionTime, schedule, overlapAction, templOrUnit, or templOrUnitQuantity. While you can sort by all fields, you can specify only one field at a time. For example, to sort by each request's creation time, add &sortBy=createTime to the URL. Include the sortOrder parameter to specify the sort order, either ascending or descending.
sortOrder Boolean Optional Order in which to sort data, either ascending (asc) or descending (desc), for the field name specified in the sortBy parameter. For example, to sort start time in ascending order, add &sortBy=startTime&sortOrder=asc.
pageSize Number Optional Maximum number of query results per page. You can control this number by configuring the HF_REST_RESULT_DEFAULT_PAGESIZE and HF_REST_RESULT_MAX_PAGESIZE parameters in the hostfactoryconf.json file.
  • If you do not specify pageSize, the number of results defined in HF_REST_RESULT_DEFAULT_PAGESIZE is returned (default 2000).
  • If you specify pageSize, the specified number of results is returned. For example, if &pageSize=3000, 3000 results are returned. Ensure that you specify pageSize to be lower than or equal to HF_REST_RESULT_MAX_PAGESIZE; otherwise, an error is returned.
startIndex Number Optional Start index of paginated query results. Valid value is 0 (default) or an integer multiple of the pageSize parameter. For example, when pageSize is 25, startIndex must be 0, 25, 50, or so on.
The startIndex and pageSize work together to return query results. For example:
  • If startIndex=0 and pageSize=100, the first 100 query results are returned.
  • If startIndex=300 and pageSize=100, the first 100 query results starting from index 300 are returned.
If you use curl, the command might look like the following example:
curl --header -b /tmp/cookie --cacert /opt/ibm/spectrumcomputing/wlp/usr/shared/resources/security/cacert.pem --tlsv1.2 -X GET https://myprimaryhost.example.com:9443/platform/rest/hostfactory/scheduleddemandrequests?hfcsrftoken=915ee7644f431e630dac68b9ab3e40bc&reqName=symA,symB&status=Active,Closed&requestId=1114,1115&requestName=AppA,AppB&createTime=10000,20000&sortBy=createTime&sortOrder=desc&startIndex=0&pageSize=100

Response

This command returns a JSON object that follows this template:
{"page":${current page number}, "records":${total number of records}, "rows":[scheduled requests array], "total":${total page number when pagination}}
For example:
{
    "page": 1,
    "records": 3,
    "rows": [
        {
            "createTime": 1598927752,
            "lastSubmittedTime": 0,
            "nextSubmissionTime": 1601280121,
            "overlapAction": "close",
            "reqName": "admin",
            "requestComments": "Comments",
            "requestId": "SD-c812f4e9-ef8e-4a36-a765-96a7b82079d2",
            "requestName": "sample3",
            "schedule": "FREQ=DAILY;COUNT=3",
            "startTimeOfFirstDemand": 1601280121,
            "status": "Active",
            "templateOrUnit": "Template-VM-5",
            "templateOrUnitQuantity": 1
        },
        {
            "createTime": 1602729928,
            "lastSubmittedTime": 1602729937,
            "nextSubmissionTime": 0,
            "overlapAction": "close",
            "reqName": "admin",
            "requestComments": "Comments",
            "requestId": "SD-7a5f39e5-88f2-4029-a62e-9943ae55fc19",
            "requestName": "sample2",
            "schedule": "",
            "startTimeOfFirstDemand": 0,
            "status": "Closed",
            "templateOrUnit": "Template-VM-5",
            "templateOrUnitQuantity": 1
        },
        {
            "createTime": 1603161640,
            "lastSubmittedTime": 1603161648,
            "nextSubmissionTime": 0,
            "overlapAction": "close",
            "reqName": "admin",
            "requestComments": "Comments",
            "requestId": "SD-2a1f611a-4953-4f22-8d90-ed1bc0841274",
            "requestName": "sample1",
            "schedule": "",
            "startTimeOfFirstDemand": 0,
            "status": "Active",
            "templateOrUnit": "Template-VM-5",
            "templateOrUnitQuantity": 1
        }
    ],
    "total": 1
}
The output appears on a single line; it is split here for clarity.
Status code Description
200 OK
400 Bad request
500 Internal server error. Check the log files and look for hints in the API response body.