Comment on page
HTTP - script API
StackState Self-hosted v5.0.x
This page describes StackState version 5.0.
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.Submit HTTP get request.
uri
- uri of the HTTP server.
.param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
- Async: HttpScriptApiTextResponse or HttpScriptApiJsonResponse if
.jsonResponse()
is used.
Http.get("https://www.google.com/?q=apples")
.timeout("30s")
.param("name", "value")
.header("name", "value")
Submit HTTP put request.
uri
- uri of the HTTP server.
.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.
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Http.put("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
.contentType("application/text")
.textRequest("{'property', 'value'}")
.jsonResponse()
Submit HTTP post request.
uri
- uri of the HTTP server.
.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.
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Http.post("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
.jsonRequest {
basicProperty "value"
objectProperty {
basicProperty 42.0
}
listProperty (["list item"])
}.jsonBody()
Submit HTTP delete request.
uri
- uri of the HTTP server.
.param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Http.delete("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
Submit HTTP options request.
uri
- uri of the HTTP server.
Http.options("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
Submit HTTP patch request.
uri
- uri of the HTTP server.
.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.
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Http.patch("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
.textRequest("{'property', 'value'}")
Submit HTTP head request.
uri
- uri of the HTTP server.
.param(name: String, value: String)
- specify the query..header(name: String, value: String)
- specify the header.
AsyncScriptResult[HttpScriptApiTextResponse]
orAsyncScriptResult[HttpScriptApiJsonResponse]
if.jsonResponse()
is used.
Http.head("http://http_server:8080/api")
.timeout("30s")
.param("name", "value")
.header("name", "value")
Last modified 1yr ago