Nav

Lookup Tables

Anypoint Partner Manager (APM) enables you to create, populate and edit a lookup table. A lookup table is a table that facilitates transaction processing by associating values. For example, this page shows how to create a lookup table that associates home partner product codes with trading partner product codes.

Creating a Lookup Table

You can create a lookup table using either the:

This section shows how to make API calls using curl to create a three-column, two-key table.

To Create a Lookup Table

  1. Create the table:

    curl -X POST -d
    '{
      "name": "ProductCodes"
     }' "https://anypoint.mulesoft.com/b2b/tpm/api/lookupTables?environmentId=yourEnvironmentId&apiKey=yourAPIKey"

    The API returns a table ID, which you use in subsequent calls.

  2. Add a field:

    curl -X POST -d
    '{
      "name": "InternalProductCode"
    }' "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/yourTableId/fields?environmentId=yourEnvironmentId&apiKey=yourAPIKey"

    The API returns an ID for the field.

  3. Use the same syntax to add two more fields:

    curl -X POST -d
    '{
      "name": "PartnerName"
    }' "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/yourTableId/fields?environmentId=yourEnvironmentId&apiKey=yourAPIKey"
    curl -X POST -d
    '{
      "name": "PartnerProductCode"
    }' "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/yourTableId/fields?environmentId=yourEnvironmentId&apiKey=yourAPIKey"

    The API returns IDs for each field.

  4. Add keys (inbound and outbound)

    Inbound

    The Inbound key is the unique combination of the first and second fields.

    curl -X POST -H
     '{
      "name": "InboundProductCodes",
      "fieldIds": [
          "fieldId1",
          "fieldId2"
            ]
     }' "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/yourTableId/keys?environmentId=yourEnvironmentId&apiKey=yourAPIKey"

    Outbound

    The Inbound key is the unique combination of the second and third fields.

    curl -X POST -H
     '{
      "name": "InboundProductCodes",
      "fieldIds": [
          "fieldId2",
          "fieldId3
            ]
     }' "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/yourTableId/keys?environmentId=yourEnvironmentId&apiKey=yourAPIKey"
  5. Use Anypoint Partner Manager to populate the table (see [Add a Row to a Table]).

  6. Query the API to incorporate table data:

    curl -X GET -H  "http://anypoint.mulesoft.com/b2b/tpm/api/lookupTables/lookup?key=OutboundProductCodes&lookupTable=ProductCodes&fields=InternalProductCode:Int1001%26PartnerName:Beta&environmentId=yourEnvironmentId1&apiKey=yourAPIKey"
    To query the lookup table from within a Mule flow, see Consuming a REST API.

Working with a Lookup Table

AFter you have created a lookup table, you can use the Anypoint Partner Manager user interface to:

  • Filter existing tables

  • Add a row to a table

  • Edit a table row

  • Delete a table row

For more information, see Working with a Lookup Table.