Use HTTP headers and responses

When working with REST APIs, Semarchy xDI Designer can manipulate HTTP headers and parameters like any other data. You must add entries for all expected headers to your HTTP REST metadata.

Configure your metadata

From the Project Explorer, open an HTTP REST metadata object. Add an HTTP method if you do not have one already.

Depending on where in your flow you plan to work with the content, continue to the HTTP requests and HTTP responses section.

For HTTP requests

To send headers or parameters with an HTTP request, you must add it to the Operation node.

In the metadata editor, find an operation node to which you want to add parameters. If a Parameters node does not exist already, open the context menu on the operation node, and select New > Parameters to create it.

Open the context menu on the Parameters node, and select New > Parameter. An individual parameter node appears. Repeat this process for as many parameters as you need.

howto request headers

Finally, set the parameter nodes' properties. Make sure to at least set a name, and a Location which tells xDI how to send it during processing. Possible values are:

  • cookie

  • header

  • path

  • query

For HTTP responses

To receive headers in an HTTP response, you must add it to a response with the appropriate response code.

In the metadata editor, find a response node where you want to add content. If a Responses node does not exist already, open the context menu on the operation node, and select New > Responses to create it.

Open the context menu on the Responses node, and select New > Response. A response node appears. Set its Code to the HTTP response code you plan to work with, or to default to catch any unspecified codes. Define as many responses as you want.

For each response you need headers from, follow these steps:

  1. Open the context menu on the appropriate response code node.

  2. If it does not exist already, create a main headers node by selecting New > Headers.

  3. Open the context menu on the Headers node, and select New > Header. An individual header node appears.

  4. Create as many individual header nodes as you need.

  5. Rename the individual header nodes to the expected name of the header.

howto response headers

You can also handle HTTP response codes as data. Define their metadata entries as follows:

  1. Open the context menu on the appropriate response code node.

  2. If it does not exist already, create a main response information node by selecting New > Response Information.

  3. Open the context menu on the Response Information node, and select New > ResponseInfo. An individual response information entry appears.

  4. Select the ResponseInfo node, and set its Type parameter to one of three options: protocolVersion, reasonPhrase, or statusCode.

  5. Create response information nodes for the other types as needed.

howto response data

Configure your mapping

Create or open a mapping.

Add HTTP REST metadata to your mapping, and unfold the HTTP method until you see the parameter or header nodes you want.

Map your datastores to and from the parameter and header nodes.

howto response mapping