Raw Request

Overview

Advanced.  This method performs a raw HTTP request, allowing the Flow builder to control all aspects of the HTTP request.  This allows a Flow to call an XML service for example, or call an HTML service, or a number of other advanced usages.  The other HTTP functions are optimized for ease-of-use with typical JSON-based services; the Raw Request function is more flexible, at the cost of being a bit harder to use. Here are a few of the use cases for Raw Request:

  • Call an XML service:  use the XML Build function to create an XML string containing your request and drag that into the body input of Raw Request.  Then use the XML Parse function to parse the body output, to create a JSON response that you can then use in the rest of your Flow.  Works equally well with an HTML service, etc.

  • Call a JSON API with a list:  The HTTP Post function implicitly forces you to pass a JSON object in the body - each input you create in the body section becomes a key in the request body.  If you want something else - such as passing a list of objects rather than an object - you can do that using Raw Request by simply building the list you want using the List functions, then calling JSON Stringify to create a string, then dragging that string into the body input of Raw Request.

  • Build a query programmatically:  You may have logic that determines your query string at runtime.  Use the Object functions - Object.Construct, Object.Set, etc - to create a query object in your Flow, then drag your object to the query input of Raw Request.  The query object will convert to the URL query string like this - if your query object is { "x": "one", "y": "two"} then the query string will be:  ?x=one&y=two

  • Build headers programmatically:  Similar to the above, the other HTTP functions implicitly force you to define your header field names at design time - the values can be dynamic, but the header field names are fixed. If you want do define them in the Flow, use the Object functions - Object.Construct, Object.Set, etc - to create a headers object in your Flow, then drag your object to the headers input of Raw Request.  For example if the headers object is { "Accept": "text/plain" } then the header string for the request would be "Accept: text/plain".

  • Call a JSON API with dynamic keys:  Similar to the above, the HTTP Post function implicitly forces you to create the keys in the request body at design time, i.e. when you are building the Flow.  If you want to build this at runtime, based on input parameters for example, you can do so build building the object using the Object functions, passing that to the JSON Stringify function, then dragging that string into the body input of Raw Request.

The Raw Request function is flexible enough to form any HTTP call - if the other HTTP functions don't have the flexibility you need, try this one instead.

Input Fields

  • URL(text): required.  The URL for the request

  • method (dropdown): Select one of the http methods:  GET, POST, PUT, PATCH, DELETE

  • headers (Object): An object representing the headers for the request.  Each key of the header will be parsed into a header string as "key: value", i.e. "Accept: text/plain"

  • query (Object): An object representing the URL query string.  Each key of the header will be appended to the URL string as follows:  url?key1=value1&key2=value2&...

  • body (text): The http request body.

Output Fields

  • statusCode (Number): the status code (200, 404, etc) returned by the service

  • headers(Object): An object representing the http response headers, in the same format as the input headers object.

  • body(text): the http response.

See Also

Functions in Workflows

About the elements of Okta Workflows