Saving a Time Frame – synthetic API
The PUT method of the API creates or updates a Time Frame.
Before you begin
You must obtain an authToken by using the login API. The token authenticates the user performing the operation. For details, see TSWS authentication.
Synthetic configuration APIs
Notes:
- If you have upgraded to version 11.3.02, you can access the Synthetic Blackout and Synthetic Time Frames APIs listed in this table.
- If you are using version 11.3.01 or earlier, you can continue to use the Execution Plan APIs to access the Blackouts.
API | Method | Description |
---|---|---|
Applications | GET | Retrieve the details of applications |
PUT | Update an existing application | |
POST | Create a new application | |
DELETE | Delete an application | |
Execution Plans | GET | Retrieve the details of Execution Plans |
PUT | ||
DELETE | Delete an Execution Plan | |
Scripts | GET | Retrieve the details of scripts |
Locations | GET | Retrieve the details of all locations |
Blackouts | POST | Retrieve the details of Blackouts |
PUT | ||
POST | Activate the Blackout | |
POST | Deactivate the Blackout | |
POST | Delete a Blackout | |
Time Frames | POST | Retrieve the details of Time Frames |
PUT | ||
POST | Delete Time Frames |
To save a Time Frame
- The API uses the PUT method with a blank ID value to create a Time Frame.
- The API uses the PUT method with a valid Time Frame ID to update the Time Frame.
Request syntax
Request with REST client
After accessing the REST client, perform the following steps:
Enter the URL for the API.
An example of a request to create a Time Frame is:https://localhost/tsws/10.0/api/appvis/synthetic/api/timeframes/save
- Add a new header row and select Authorization as the header type.
Enter the text authToken followed by the authToken generated through the login API.
- Enter the json code in the request body
- Click Send.
Request parameters
Element | Description |
---|---|
authToken | Value of authToken |
Request body
The following code is an example of the JSON code to send with the request. The code returns the ID of the Time Frame being saved or an error message.
Sample request to create a Time Frame
"recurrenceFrequency": {
"recurrenceFrequencyDetails": "0",
"recurrenceFrequencyType": "ALWAYS"
},
"name": "Example : Always active ",
"description": "Start immediately",
"associatedObjects": [],
"timeSpan": {
"startTime": "",
"endTime": "",
"endTimeType": "NA"
},
"id": ""
}
Sample request to update a Time Frame
"recurrenceFrequency": {
"recurrenceFrequencyDetails": "01012020",
"recurrenceFrequencyType": "ALWAYS"
},
"name": "Example : Always active ",
"description": "Start from",
"associatedObjects": [],
"timeSpan": {
"startTime": "08:30",
"endTime": "",
"endTimeType": "NA"
},
"id": "5e6a630c-2034-4176-829a-3af28ae03505"
}
Request body parameters
Parameter | Description | Value |
---|---|---|
Id | Time Frame ID | For creating a Time Frame, do not set any value. id=" " For updating a Time Frame, set the Time Frame ID. id = <Time Frame ID> |
name | Name of the Time Frame | String. It must be between 1 - 255 characters. |
description | Description of the Time Frame | String. (Optional) It can be blank. If you specify, it must be less than or equal to 255 characters. |
associatedObjects | Associated Blackout IDs that use the Time Frame | Do not set any value when you create or update it. |
recurrenceFrequency | ||
recurrenceFrequencyDetails | Recurrence Frequency details | ALWAYS –
ONCE –
WEEKLY –
Comma-separated numeric values: 1,2,3,4,5,6,7 (Where 1 is Monday and 7 is Sunday.) MONTHLY –
Numeric value or range , for example 2 or 2,3,5 or 2-6 |
recurrenceFrequencyType | Recurrence Frequency options |
|
timeSpan | ||
startTime | Time from when the blackout period is in use | HH:MM Note: Do not set any value for the combination ALWAYS ACTIVE and Start Immediately options. |
endTime | Time from when the blackout period is no longer used | TIME:
DURATION:
End Of Day – 00:00 Note: No value is required for the ALWAYS option. |
endTimeType | End Time options |
Note: For End Of Day, set the endTimeType value as TIME and endTime value as 00:00. |
Response
The response returns the Time Frame ID.
Related topics