How to use the User Defined credential type

Note: This article applies to the web services data actions integration.

When you add the web services data actions integration, you can select a credential type: Basic Auth, User Defined, or User Defined (OAuth). For more information, see Add a data actions integration and Credential types.

This article explains how to use the User Defined credential type. 

  1. When you add the integration, configure the User Defined credentials.

    Add field names for the API that you are using and values for those field names.

    Configure Credentials for User Defined

  2. Use field names from your credentials in the requests of all custom actions that you create. 

    The following example is a request for a custom action called Get Weather. credentials is a static keyword, which you can use with other Velocity macros. API_Key is the field name that you added to the credential configuration. For more information, see Velocity macros for data actions.

    Although the integration redacts the values of field names, the actual values appear in your web service. For example, if the value for API_Key is 12345, then when the action executes, the requestUrlTemplate that you see in your web service is “https://api.openweathermap.org/data/2.5/weather?q=London&APPID=12345”. For more information, see Create a custom action, Add configuration to custom actions, and Request configuration.

    Warning: Be sure to escape any use of input or output variables within requestTemplate, successTemplate, or requestUrlTemplate. If you do not properly escape variables with special characters, your data actions will fail at execution.
    • Use esc.jsonString to escape strings inside JSON bodies.

      For more information, see the esc.jsonString section in Velocity macros for data actions.

    • Use esc.url() or urlTool.optionalQueryParam() to properly escape path or query parameters for a requestUrlTemplate or requestTemplate if using x-www.form-urlencoded values.

      For more information, see the String-escaping library section in Velocity macros for data actions.

    Because escaping is JSON context-specific, the following example intentionally does not show escaping.

    {
      "requestUrlTemplate": "https://api.openweathermap.org/data/2.5/weather?q=London&APPID=${credentials.API_Key}",
      "requestType": "GET",
      "headers": {},
      "requestTemplate": "${input.rawRequest}"
    }
    Note: When you test a custom action, the integration redacts any authorization information. For more information, see Test a custom action.

For more information about the integration, see About the web services data actions integration.