Retrieving script details -- API


The GET method of the scripts  API retrieves the details of one synthetic script or all synthetic scripts.

  • Use getAll to retrieve details about all of your scripts.
  • Use getScriptMetaById to retrieve more in depth details of a single script.

 

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 retrieve one script or all scripts

The scripts  API uses the GET method to retrieve the details of a script. Use the following request syntax:

 

For retrieving the details of a single script

https://<PresentationServerHostName>/tsws/10.0/api/appvis/synthetic/api/scripts/getScriptMetaById?scriptId=<SID>

 For retrieving the details of all scripts

https://<PresentationServerHostName>/tsws/10.0/api/appvis/synthetic/api/scripts/getAll

In the above examples:

  • <PresentationServerHostName>  indicates the host name of the TrueSight Presentation Server.
  • <SID> indicates the ID of the script.

Sample 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 for a single script is:

    https://localhost/tsws/10.0/api/appvis/synthetic/api/scripts/getScriptMetaById?scriptId=3

  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. Click Send.

Request parameters

Element

Description

authToken

Value of authToken

Query parameters

scriptId

ID of the App Visibility Portal

Response

The following sample is the JSON code returned by the API for a for the Pinger script:

{
"data" : {
"name" : "Pinger.ltz"
"attributes" : [5]
0 : {
"encrypted" : 0
"defaultValue" : "1"
"name" : "Number of Pings"
"encryptionType" : 0
"description" : "Number of pings to be sent"
"type" : "number"
"value" : "1"
"order" : 2
}
-
1 : {
"encrypted" : 0
"defaultValue" : "Sv_ICMP Ping"
"name" : "Timer Name"
"encryptionType" : 0
"description" : "Name of the ICMP Ping Timer"
"type" : "string"
"value" : "Sv_ICMP Ping"
"order" : 4
}
2 : {
"encrypted" : 0
"defaultValue" : "1.000000000"
"name" : "Ping Timeout"
"encryptionType" : 0
"description" : "Timeout value for the ping in seconds"
"type" : "float"
"value" : "1.000000000"
"order" : 1
}
3 : {
"encrypted" : 0
"defaultValue" : ""
"name" : "Host"
"encryptionType" : 0
"description" : "The host being monitored"
"type" : "string"
"value" : ""
"order" : 0
}
4 : {
"encrypted" : 0
"defaultValue" : "32"
"name" : "Data Size"
"encryptionType" : 0
"description" : " Size of the data package to be sent in bytes "
"type" : "number"
"value" : "32"
"order" : 3
}
"id" : 3
"projectName" : "Pinger"
"version" : 10.7.00
}
}

The following sample is the JSON code returned by the API for a for all scripts:

{
"data" : [10]
0 : {
"createdAt" : 1456119902455
"createdBy" : "dave"
"name" : "PasswordChecker_Big_Timeout_with_attribute11.ltz"
"projectDescription" : "Default Project"
"id" : 28
"projectName" : "PasswordChecker"
"version" : "123456"
}

1 : {
"createdAt" : 1456119903439
"createdBy" : "dave"
"name" : "PasswordChecker_Big_Timeout_with_attribute10.ltz"
"projectDescription" : "Default Project"
"id" : 29
"projectName" : "PasswordChecker"
"version" : "123456"
}

2 : {
"createdAt" : 1456039670845
"createdBy" : "System"
"name" : "URLChecker.ltz"
"projectDescription" : " This monitor checks a URL by downloading its pages and embedded objects. Verification can be defined for title and content. "
"id" : 6
"projectName" : "URLChecker"
"version" : "10.7.00"
}

3 : {
"createdAt" : 1456120000439
"createdBy" : "dave"
"name" : "PasswordChecker_Big_Timeout_with_attribute1.ltz"
"projectDescription" : "Default Project"
"id" : 37
"projectName" : "PasswordChecker"
"version" : "123456"
}

4 : {
"createdAt" : 1456039670392
"createdBy" : "System"
"name" : "Pop3Pinger.ltz"
"projectDescription" : " This monitor connects to a POP3 server to check its availability. "
"id" : 4
"projectName" : "Pop3Pinger"
"version" : "10.7.00"
}

5 : {
"createdAt" : 1456039669501
"createdBy" : "System"
"name" : "FtpPinger.ltz"
"projectDescription" : " This Monitor checks the availability of an FTP server by connecting to it and retrieving the current directory of the server. "
"id" : 1
"projectName" : "FtpPinger"
"version" : "10.7.00"
}

6 : {
"createdAt" : 1456120019893
"createdBy" : "dave"
"name" : "PasswordChecker_Big_Timeout_with_attribute.ltz"
"projectDescription" : "Default Project"
"id" : 7
"projectName" : "PasswordChecker"
"version" : "39393939"
}

7 : {
"createdAt" : 1456039670282
"createdBy" : "System"
"name" : "Pinger.ltz"
"projectDescription" : " This monitor checks the availability of a specified host by sending an ICMP echo request (ping). "
"id" : 3
"projectName" : "Pinger"
"version" : "10.7.00"
}

8 : {
"createdAt" : 1456039670610
"createdBy" : "System"
"name" : "SmtpPinger.ltz"
"projectDescription" : " This monitor connects to an SMTP server to check its availability "
"id" : 5
"projectName" : "SmtpPinger"
"version" : "10.7.00"
}

9 : {
"createdAt" : 1456039670079
"createdBy" : "System"
"name" : "LdapPinger.ltz"
"projectDescription" : " This monitor checks the availability of an LDAP server by connecting to it and exchanging authentication information between the client and server. "
"id" : 2
"projectName" : "LdapPinger"
"version" : "10.7.00"
}

}

Response body parameters

The following table lists the parameters returned by the API for a single script:

Parameter

Description

Value

name

File name of the script

String

attributes

Attributes of the script run by the Execution Plan (can be multiple)

 

    encrypted

Indicates whether the attribute is encrypted

0 - False

1 - True

    defaultValue

Default value of the attribute

Varies depending on the attribute

    name

Name of the attribute

String

    encryptionType

Type of encryption used for this attribute

0 - No encryption

1,2 - Indicates encryption type

    description

Description of the attribute

String

    type

Data type of the attribute

  • boolean
  • float
  • number
  • string

    value

Value of the attribute

Varies depending on the attribute

    order

Serial number of the appearance of the attribute in the user interface

Number

id

ID of the script

Number

version

Version number that is incremented each time there is a change in script attributes for custom scripts

App Visibility version number for default scripts

String

The following table lists the parameters returned by the API for all scripts:

Parameter

Description

Value

createdAt

Time and date when the script was created, in UTC format

Number

createdBy

Name of the user who uploaded the script to App Visibility

String

name

Name of the script file

String

projectDescription

Description of the project in Silk Performer

String

id

ID of the script

Number

projectName

Name of the project in Silk Performer

String

version

Version number that is incremented each time there is a change in script attributes for custom scripts

App Visibility version number for default scripts

String

 

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