HTTP - script API
StackState Self-hosted v4.5.x
This page describes StackState v4.5.x. The StackState 4.5 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.5 version range to upgrade to a more recent release.
Sometimes it may be useful to process the retrieved topology or telemetry data using an external tool. For example, to perform analysis using a custom Python script, a cloud service or an Machine Learning framework. StackState can call out to any external service via HTTP using the functions in this script API.
The permission execute-restricted-scripts
is required to execute scripts using the HTTP script API in the StackState UI analytics environment. For details, see the analytics page permissions.
Function: get
get
Submit HTTP get request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
Return type:
Async: HttpScriptApiTextResponse or HttpScriptApiJsonResponse if
.jsonResponse()
is used.
Example:
Function: put
put
Submit HTTP put request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header..contentType(contentType: String)
- specify the content type, for example "application/text"..textRequest(text: String)
- specify the text of the request..jsonRequest(json: Goovy.lang.Closures)
- specify the JSON of the request. This will wrap the given closure with a JsonBuilder..jsonBody()
- get the body of the JSON response..jsonResponse()
- get the JSON response.
Return type:
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Example:
Function: post
post
Submit HTTP post request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header..contentType(contentType: String)
- specify the content type, for example "application/text"..textRequest(text: String)
- specify the text of the request..jsonRequest(json: Goovy.lang.Closures)
- specify the JSON of the request. This will wrap the given closure with a JsonBuilder..jsonBody()
- get the body of the JSON response..jsonResponse()
- get the JSON response.
Return type:
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Example:
Function: delete
delete
Submit HTTP delete request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
Return type:
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Example:
Function: options
options
Submit HTTP options request.
Function: patch
patch
Submit HTTP patch request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header..contentType(contentType: String)
- specify the content type, for example "application/text"..textRequest(text: String)
- specify the text of the request..jsonRequest(json: Goovy.lang.Closures)
- specify the JSON of the request. This will wrap the given closure with a JsonBuilder..jsonBody()
- get the body of the JSON response..jsonResponse()
- get the JSON response.
Return type:
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Example:
Function: head
head
Submit HTTP head request.
Args:
uri
- uri of the HTTP server.
Builder methods:
.timeout(time: Duration)
- make the request timeout after time has elapsed..param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
Return type:
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Example:
Last updated