GetREST
Step facilitates REST GET interactions and will return the returned data dictionary and specified headers as data to the next step
Added in version 1.5.0.
Friendly name:
GetRESTStep class:
base_steps_syncpack.steps.GetREST.GetRESTStep version:
1.0.0Required parameters:
prefix_url
Parameters
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
number |
no |
|
The max number of records to fetch in one REST call. Example: |
|
string |
no |
– |
The value that is specified in the url to indicate where to start grabbing data. For example: ?offset=50. Example: |
|
string |
no |
– |
The value that is specified in the url to indicate the max number of records to return in this REST call. For example: ?limit=1000. Example: |
|
string |
no |
|
If the data is set in chunks, the field name in the response that indicates how many total rows for this object. |
|
string |
no |
|
If the data is set in chunks, the field name in the response that indicates how many rows were returned. |
|
boolean |
no |
|
Enable if api response does not contain a response total count |
Required inherited parameters
These are defined on Shared parameters: HTTPBaseStep but are required here, so a working configuration must set them.
Name |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
yes |
– |
used with relative_url to create the full URL. Example: |
Other inherited parameters
This step also accepts 31 optional parameter(s) inherited from Shared parameters: HTTPBaseStep.
Every step also accepts the platform parameters common to all steps – see Platform parameters.
Dependencies
Inherits from:
GetREST->HTTPBaseStep->BaseStep->SerializableSyncPack modules:
base_steps_syncpack.steps.HTTPBaseStep,base_steps_syncpack.util.request_paramsExternal packages:
ipaascommon
Behaviour
Fixes method = "GET" and enable_paging = True, then delegates to
Shared parameters: HTTPBaseStep. The parameters above are the paging controls; the
request itself (URL, auth, timeouts, SSL) is configured through the shared HTTP
parameters.
Outputs
The accumulated, fully paged result assembled by HTTPBaseStep — see its
Outputs section for the exact shape.
On a StepFailedException that carries an error body, the step saves that body
for the next step before re-raising, so a downstream error-handling branch can
read it:
{
"http_code": 404,
"headers": {"content-type": "application/json"},
"body": {"error": "not found"}
}
body is the parsed response JSON when it parses. When it does not, body is
the string "It was not possible to parse the received response" rather
than a dict — so an error handler that subscripts body breaks on exactly the
malformed responses it was written to catch.
Example
Paging a ServiceNow table 100 records at a time:
{
"prefix_url": "https://example.service-now.com",
"relative_url": "/api/now/table/cmdb_ci_server",
"auth_method": "http_basic",
"username": "svc_powerflow",
"password": "${config.snow_password}",
"result_key": "result",
"chunk_size": 100,
"chunk_name_for_pos_in_url": "sysparm_offset",
"chunk_name_for_max_in_url": "sysparm_limit"
}
Notes
chunk_sizedefaults to0, which disables paging. Pagination only happens once you set it and the twochunk_name_for_*_in_urlparameters — settingchunk_sizealone sends one unpaged request.Use
missing_return_totalfor APIs that return records but no total count. Without it the step cannot tell that it has reached the last page.