Raw Request

This method performs a raw HTTP request, allowing you as a flow builder to control all aspects of the HTTP request. This allows a flow to call an XML service or call an HTML service, or a number of other advanced usages. The other API Connector functions are optimized for ease-of-use with typical JSON-based services. The Raw Request function card is more flexible.

Any data flowing through this card (or any card) may be logged in flow history and exposed to other Workflows admins. Sensitive secrets such as access tokens should not be entered, read, or processed in plain text in a flow, but should be securely stored in a connector.

Here are a few of the use cases for this function card:

  • Call an XML service: Use the XML Build function card to create an XML string containing your request and drag that into the body input of the Raw Request function card. 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 well also with an HTML service.

  • Call a JSON API with a list: The API Connector 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, then you can do so using a Raw Request function card by building the list you want using the List functions, then calling JSON Stringify function card to create a string, then dragging that string into the body input of the Raw Request function card.

  • Build a query programmatically: You may have logic that determines your query string at runtime. Use the Object function cards (Construct, Set, and so forth) to create a query object in your flow, then drag your object to the query input of the Raw Request function card. The query object will convert to the URL query string: If your query object is { "x": "one", "y": "two"}, then the query string will be:  ?x=one&y=two.

  • Build headers programmatically: Similarly, the other API Connector 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 function cards (Construct, Set, and so forth) to create a headers object in your flow, then drag your object to the headers input of the Raw Request function card. 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: Similarly, the API Connector Post function implicitly forces you to create the keys in the request body at design time (when you are building the flow). If you want to build this at runtime, (for example, based on input parameters), then you can do so by building the object using the Object function cards, passing that to the JSON Stringify function card, then dragging that string into the body input of the Raw Request function card.

The Raw Request function card is flexible enough to form any HTTP call. If the other HTTP functions don't have the flexibility you need, use the Raw Request function card instead.

Input

Field Definition Type Required
URL URL for the HTTP request. String TRUE
Method HTTP method. Options are GET, POST, PUT, PATCH, or DELETE. Dropdown TRUE
Headers An object representing the headers for the request.  Each key of the header will be parsed into a header string as "key: value". For example., "Accept: text/plain". Object FALSE
Query 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&... Object FALSE
Body HTTP request body. String FALSE

Output

Field Definition Type
Response    
Status Code Result of the operation. The HTTP status code is returned by the connector and indicates whether the action taken by the card succeeded or failed. For example:
  • A 201 Created status code indicates success where a new resource was created.
  • A 403 Forbidden error indicates that the HTTP request was not processed because the necessary permissions were missing.

For a full list of possible status codes, see HTTP status codes.

Number
Headers Detailed context for the status code, unrelated to the output body. Response headers are dependent on your selected HTTP request option. Note that not all headers are response headers. This will be usually similar to {"Content-type":"application/json"}. Object
Body Data returned from your selected HTTP request (for example, the data from a GET request). Object

Related topics

Functions in Workflows

About the elements of Okta Workflows