HttpV2
Common Scripts Pack.#
This Script is part of theSupported versions
Supported Cortex XSOAR versions: 6.5.0 and later.
Sends a HTTP request with advanced capabilities
#
Script DataName | Description |
---|---|
Script Type | python3 |
Tags | basescript |
Cortex XSOAR Version | 6.5.0 |
#
InputsArgument Name | Description |
---|---|
url | Specify where the request should be sent. Include the URI scheme ('http' or 'https'). |
method | Specify the HTTP method to use. |
headers | Specify a hash of headers to send with the request. Headers can be of string type but need to be formatted in the following ways: `{"key1": "value1", "key2": "value2"}` or `"key1": "value1", "key2": "value2"` |
body | Specify the body of the request. |
request_content_type | Specify the Content-Type header for the request. Shorthands are provided for the following common content types: json (application/json) xml (text/xml) form (application/x-www-form-urlencoded) data (multipart/form-data) If you choose to define a different type, please include the full type name, e.g: application/pdf |
response_content_type | Specify the Accept header for the request - the response content type. Shorthands are provided for the following common content types: json (application/json) xml (text/xml) form (application/x-www-form-urlencoded) data (multipart/form-data) If you choose to define a different type, please include the full type name, e.g: application/pdf |
parse_response_as | Specify how you would like to parse the response. |
auth_credentials | Basic authorization. Please set values in the format: username,password. For Bearer token please use the headers. |
params | URL parameters to specify the query. |
timeout | Specify the timeout of the HTTP request in seconds. Defaults to 10 seconds. |
enable_redirect | The request will be called again with the new URL. |
retry_on_status | Specify the array of status codes that should cause a retry. For example: 301-303,400,402. |
retry_count | Specify the number or retries to be made in case of a failure. Defaults to 3. |
timeout_between_retries | Specify the timeout between each retry in seconds. Defaults to 5. |
save_as_file | Save the response in a file. |
filename | filename |
unsecure | Trust any certificate (not secure) |
proxy | Use system proxy settings |
#
OutputsPath | Description | Type |
---|---|---|
HttpRequest.Response.StatusCode | The number that indicates the status of the request. | String |
HttpRequest.Response.StatusText | The text corresponding to the status code | String |
HttpRequest.Response.URL | The URL of the response | String |
HttpRequest.Response.ParsedBody | The parsed response, according to `parse_response_as` argument. | String |
HttpRequest.Response.Headers | The response headers. | String |
HttpRequest.Response.Body | The response data. | Unknown |
#
Script Examples#
Example command!HttpV2 method=GET url="https://test.jamfcloud.com/JSSResource/computers/id/1/subset/General" response_content_type=json request_content_type=json auth_credentials=myUser,myPass parse_response_as=json
#
Context Example#
Human Readable OutputSent a GET request to https://test.jamfcloud.com/JSSResource/computers/id/1/subset/General