Creating a time frame


The create API uses the POST method to create a time frame. You must provide authentication credentials by using the login API before creating a time frame. For information about the authentication process, see Web services authentication.

URL to create a time frame

The generic format of a URL for the create API is as follows: 

http://<TSPShostname>:port#/tsws/10.0/api/unifiedadmin/Timeframe/create
Example
http://tsps101:port#/tsws/10.0/api/unifiedadmin/Timeframe/create

Input parameters in the JSON format to create a time frame

When you provide input parameters for any web service request, you must specify the content-type parameter in the header of the web service request as follows:

content-type application/json

Sample input parameters in the JSON format are as follows:

Sample input parameters for the create API to create a time frame

{
           "timeframe": {
               "name": "TF-alwaysactive",
               "description": "",
               "startTime": "0:0",
               "endHour": {
                   "time": "00:00",
                   "type": "timeDuration"
               },
               "recurrencePattern": {
                   "recurrence": "always_active",
                   "details": {
                       "date": "0"
                   }
               }
           }
       }

 List of parameters that must be provided to access the create API

Attributes

Description

recurrence

Specifies how often the time frame reoccurs. The supported values are as follows:

  • once
  • daily
  • weekly
  • monthly

The default value is daily. Based on the recurrence value, the mandatory parameters you must provide are listed as follows:

  • once—datestartTime and endHour
  • daily—startTimeendHour, and days
  • weekly—daysOfWeekstartTime, and endHour
  • monthly—datesstartTime, and endHour

date

Specifies the date for the time frame to be active. It is represented in epoch format. If you have selected once as the recurrence attribute value, you must specify the {{date parameter.

endHour

Specifies the end time for the time frame

type

Specifies the type of the end time for the time frame. The supported types are as follows:

  • time—Indicates the actual time. The syntax is hh:mm.
  • timeDuration—Indicates the time duration that you want the time frame to be active. The supported values are as follows:
    • 00:05
    • 00:10
    • 00:15
    • 00:30
    • 1:00
    • 2:00
    • 3:00
    • 4:00
    • 5:00
    • 6:00
    • 7:00
    • 8:00
    • 9:00
    • 10:00
    • 11:00
    • 12:00
    • 18:00
    • 24:00

startTime

Specifies the start time for the time frame to be active. The syntax for the start time is hh:mm.

days

Specifies the days you want the time frame to be active. The supported values are as follows:

  • all
  • excludeWeekends

The default value is all.

daysOfWeek

Specifies the specific days for which you want the time frame to be active. The supported values are as follows:

  • 1—Indicates Monday
  • 2—Indicates Tuesday
  • 3—Indicates Wednesday
  • 4—Indicates Thursday
  • 5—Indicates Friday
  • 6—Indicates Saturday
  • 7—Indicates Sunday

dates

Specifies the date for which you want the time frame to be active. You can also specify a range of dates. For example: 5-10

You can also provide multiple dates, separated by commas. For example: 5,9,13,17

name

Name of the time frame

Description

A brief description for the time frame

Response information for the create API

A sample JSON response is as follows:

{
   "responseTimeStamp": "2015-04-12T09:37:11",
   "statusCode": "200",
   "statusMsg": "OK",
   "response": [
       {
           "resourceId": "b3df23a2-96be-4c36-813a-da7dfd6d9a3e",
           "resourceName": " TF-alwaysactive,
            "
resourceURI": null,
            "
statusCode": "200",
            "
statusMsg": "OK"
       }
    ]
}

Related topics

Managing-time-frames

Performing-Central-Monitoring-Administration-functions-with-web-services

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*