Skip to main content

Network Request Action

The NetworkRequestAction class is used to make network requests in Stac applications.

Properties​

PropertyTypeDescription
urlStringThe URL to which the request is sent.
methodMethodThe HTTP method to use for the request. Defaults to Method.get.
queryParametersMap<String, dynamic>?The query parameters to include in the request URL.
headersMap<String, dynamic>?The headers to include in the request.
contentTypeString?The content type of the request.
bodydynamicThe body of the request.
resultsList<StacNetworkResult>The list of results to handle different status codes. Defaults to an empty list.

Method​

The Method enum defines the different HTTP methods that can be used in the Stac Network Request Action.

ValueDescription
getSends a GET request.
postSends a POST request.
putSends a PUT request.
deleteSends a DELETE request.

StacNetworkResult​

The StacNetworkResult class is used to handle different status codes in the Stac Network Request Action.

PropertyTypeDescription
statusCodeintThe status code to handle.
actionActionThe action to perform when the status code is received.

Example JSON​

{
"actionType": "networkRequest",
"url": "https://example.com/api",
"method": "get",
"queryParameters": {
"page": 1
},
"headers": {
"Authorization": "Bearer token"
},
"contentType": "application/json",
"body": {
"data": "example"
},
"results": [
{
"statusCode": 200,
"action": {
"actionType": "none"
}
},
{
"statusCode": 404,
"action": {
"actionType": "none"
}
}
]
}