The GET step allows for making GET requests.
get_step:
call: http.get
args:
url: https://www.example-url.com
limit: 500
result: responseVariableMandatory fields:
call, with valuehttp.get- determines the step typeargsurl- the desired resource to querycontentType- if set tojson_overrideoverrides response content type with application/json.
Optional fields:
argsquery- ..desired query values - Scripts can be used for query values
headers- ..desired header values - Scripts can be used for headers values
result- name of the variable to store the response of the query in, for use in other steps- NB! if
resultfield is missing, the request will be done immediately and non-blockingly, so the DSL execution does not wait for response. Any data that would be sent with response is not handled by Ruuter.
- NB! if
limit- limit the size of allowed response in kilobytes (default value is configured in application.yaml)timeout- (in milliseconds) overwrites http request timeout set in application properties (or if not defined there, 15000ms)
If a result field is valued, then both the request parameters and request response are stored into a variable with the designated name.
Request parameters are stored under the request field
Request response is stored under the response field
The resulting object looks like this, assuming that the result field is valued getStepResult:
{
"getStepResult": {
"request": {
"url": ...,
"query": ...,
"headers": ...,
"body": ...
},
"response": {
"body": {
...body
},
"headers": {
...headers
},
"status": ...
}
}
}
get_message:
call: http.get
args:
url: http://localhost:8080/steps/return/return-with-script
query:
some_val: "Hello World"
another_val: 123
result: the_message
get_message:
call: http.get
args:
url: http://localhost:8080/steps/return/return-with-script
headers:
Content-Type: "text/plain"
result: the_message
assign_values:
assign:
stringValue: "Bürokratt"
integerValue: 2021
get_message:
call: http.get
args:
url: http://localhost:8080/steps/return/return-with-script
query:
some_val: ${stringValue}
another_val: ${integerValue}
result: the_message
get_message:
call: http.get
args:
url: http://localhost:8080/steps/return/return-with-script
result: the_message
return_value:
return: ${the_message.response}
get_message:
call: http.get
args:
url: http://localhost:8080/steps/return/return-with-script
query:
var: "value"
result: the_message
return_value:
return: ${the_message.request}
It is possible to specify the DSL step to follow when GET request gets a
non-OK response. For that the error field can be used
get_message:
call: http.get
args:
url: http://localhost:8080/guards/fail/mock-response #step that always gives 403
query:
var: "value"
result: the_message
error: error_step
return_value:
return: ${the_message.request}
error_step:
return: "Request failed"
status: 500