DataPower Gateway only

map

Use the map policy to transform your assembly flow and specify relationships between variables.

For information about the use and structure of the map policy, see The Map policy structure. For more information about API properties that affect the map policy, see API properties.

The map policy has the following format:

- map

   title: title
   description: description

   inputs:
      - input_1:
         variable: context_1
         $ref: '#/definitions/definition_1'
      - input_2
         variable: context_2
         type: type_2
         content: content_type

   outputs:
      - output_3
         variable: context_3
         type: type_3

   actions:
      - set: output_3.output_property_3
        from: input_1.input_property_1

      - set: output3.output_property_3
        from:
         - input1.input_property_1
         - input2.input_property_2
        value: 'script_A'
        default: 'default_A'

      - create: output3.output_property_3
        from: input1.input_property_1
        foreach: input1.input_property_1
        actions:
          - further_actions
   options:
            includeEmptyXMLElements: boolean
            namespaceInheritance: boolean
            inlineNamespaces: boolean
Table 1.
Property Required Description Data type Belongs to
title No A title for the policy. String N/A
description No A policy description. String N/A
inputs No An array listing the inputs of the map policy. Object N/A
outputs Yes An array listing the outputs of the map policy. Object N/A
variable Yes A reference to the context variable that is the location of the input or output variable.. String inputs or outputs
$ref Yes* A reference to the definition of the type of the variable. String inputs or outputs
type Yes* The type of the variable. String inputs or outputs
content No The content type of the variable: application/xml or application/json. If None is selected, or the field is not included, then the type is treated as JSON. String inputs or outputs
actions Yes Lists actions to be performed by the map policy. Object N/A
set Yes** Specifies by name the output variable that is to be set to a value by the action. String actions
create Yes** Specifies by name the output variable that is to have a value appended to it by the action. String actions
from No Specifies by name any input variables used by the action. String actions
value No Contains a script that maps and transforms input variables into output variables. String actions
default No a static value, or an inline variable reference, to be applied to the output when no input value is provided. For information on inline variable references, see Inline references. String actions
foreach No Specifies by name an array for which further actions should be performed for each element. String actions
[V5.0.4 or later]options No Advanced XML options to control empty elements, inherit namespaces, and define namespaces inline. Boolean outputs
[V5.0.8 or later]messagesInputData (From API Connect Version 5.0.8.7) [V5.0.8 or later]No [V5.0.8 or later]This property defines the severity level for log messages that relate to input data. Specify one of the following values:
  • error
  • warn
  • info
[V5.0.8 or later]String [V5.0.8 or later]options

* There must be one of $ref or type in the description of a variable.

** There must be one of set or create in an actions field.

Example

      - map:
          title: Output mapping
          inputs:
            Monthly_cost:
              schema:
                type: double
              variable: loan_invoke.body.monthly_payment
              content: application/json
            Duration:
              schema:
                type: integer
              variable: request.parameters.duration
          outputs:
            Quote_Output:
              schema:
                $ref: '#/definitions/Quote_Output'
              variable: message.body
              content: application/json
          actions:
            - set: Quote_Output.monthly_repayment
              from: Monthly_cost
              value: ''
            - set: Quote_Output.total_cost
              from:
                - Duration
                - Monthly_cost
              value: '$(Duration)*$(Monthly_cost)'
          description: Maps and transforms contexts to the operation output.
          options:
              includeEmptyXMLElements: true
              namespaceInheritance: true
              inlineNamespaces: true