For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuides
ReferenceGuides
  • Core
    • Introduction to SWML
    • Expressions
    • Template functions
    • Variables
    • Errors
  • Calling
    • Overview
    • ai
    • ai_sidecar
    • amazon_bedrock
    • answer
    • cond
    • connect
    • denoise
    • detect_machine
    • enter_queue
    • execute
    • goto
    • hangup
    • join_conference
    • join_room
    • label
    • live_transcribe
    • live_translate
    • pay
    • play
    • prompt
    • receive_fax
    • record
    • record_call
    • request
    • return
    • send_digits
    • send_fax
    • send_sms
    • set
    • sip_refer
    • sleep
    • stop_denoise
    • stop_record_call
    • stop_tap
    • switch
    • tap
    • transcribe
    • transcribe_stop
    • transfer
    • unset
    • user_event
  • Messaging
    • Overview
    • execute
    • goto
    • label
    • receive
    • reply
    • request
    • return
    • switch
    • transfer
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Variables
  • Examples
  • Making a GET Request
Calling

request

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

return

Next
Built with

Send a GET, POST, PUT, or DELETE request to a remote URL.

Properties

request
objectRequired

An object containing the following properties.

request.url
stringRequired

URL to send the HTTPS request to. Authentication can also be set in the url in the format of username:password@url.

request.method
stringRequired

Request type. GET|POST|PUT|DELETE

request.headers
object

Object containing HTTP headers to set. Valid header values are Accept, Authorization, Content-Type, Range, and custom X- headers

request.body
string | object

Request body. Content-Type header should be explicitly set, but if not set, the most likely type will be set based on the first non-whitespace character.

request.connect_timeout
numberDefaults to 0

Maximum time in seconds to wait for a connection. Default is 0 (no timeout).

request.timeout
numberDefaults to 0

Maximum time in seconds to wait for a response. Default is 0 (no timeout).

request.save_variables
booleanDefaults to false

Store parsed JSON response as variables

Variables

Set by the method:

  • request_url: (out) URL the request was sent to.
  • request_result: (out) success | failed.
  • return_value: (out) The same value as the request_result.
  • request_response_code: (out) HTTP response code from the request.
  • request_response_headers.<header name lowercase>: (out) HTTP response headers. Header names should be normalized to lowercase and trimmed of whitespace. A maximum of 64 headers are saved. Ex: ${request_response_headers.content-type}.
  • request_response_body: (out) Raw HTTP response body. This is limited to 64KB.
  • request_response.<object_field>: (out) Variables saved from the response if save_variables is true and parsed as JSON.

For example, if the server responds with the following JSON:

1 { "status": "created", "time": "2 seconds ago", "number": { "home": "n/a" } }

The variables request_response.status, request_response.time, and request_response.number.home are set.

Examples

Making a GET Request

1version: 1.0.0
2sections:
3 main:
4 - answer: {}
5 - request:
6 url: 'https://jsonplaceholder.typicode.com/todos/1'
7 method: GET
8 save_variables: true
9 timeout: 10
10 - play:
11 url: 'say: the title is: ${request_response.title}'