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

https://<PresentationServerHostName>/tsws/10.0/api/appvis/synthetic/api/timeframes/save

Request with REST client

After accessing the REST client, perform the following steps:

  1. 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

  2. Add a new header row and select Authorization as the header type.
  3. Enter the text authToken followed by the authToken generated through the login API. 

  4. Enter the json code in the request body
  5. 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.

  • If the "id" field is blank or contains no value, a new Time Frame configuration is saved.
  • If the "id" field contains a valid Time Frame ID, the existing Time Frame configuration is updated.


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

  • start immediately – ‘0’
  • Start from – date format  dd-mm-yyyy

ONCE

  • Date format : dd-mm-yyyy

WEEKLY

  • Days of the week when the blackout period is in effect.

Comma-separated numeric values:

 1,2,3,4,5,6,7 (Where 1 is Monday and 7 is Sunday.)

MONTHLY

  • Days of the month when the blackout period is in effect:

Numeric value or range , for example

2 or 2,3,5 or 2-6

     recurrenceFrequencyType

Recurrence Frequency options

  • ALWAYS
  • ONCE
  • WEEKLY
  • MONTHLY

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:

  • HH:MM For example,  21:00

DURATION:

  • Hours:Minutes For example, 03:30
    Notes: Maximum Duration for Once is 999 Hours. Maximum Duration for Weekly and Monthly is 24 Hours.

End Of Day – 00:00

Note: No value is required for the ALWAYS option.

     endTimeType

End Time options

  • TIME
  • DURATION
  • NA - This is relevant only when you are using the ALWAYS option.

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

Developing

 

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