You can associate a function with an API and use the function as a prefilter or a post-filter for the API only after you publish the function. This way, the function can process the request parameters or responses of the API. This topic describes how to publish a function on the DataService Studio page.

Prerequisites

Publish a function

  1. Go to the DataService Studio page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces. In the top navigation bar, select the region in which your workspace resides. Find the workspace, move the pointer over the More icon in the Actions column, and then select DataService Studio.
  2. In the left-side navigation pane of the Service Development page, find the function that you want to publish and double-click the name of the function.
  3. On the configuration tab of the function, click Submit in the upper-right corner.
  4. In the right-side navigation pane of the configuration tab, click Version. On the Version tab, find the version that is in the Can Be Published state and click Publish in the Actions column.
    Pbulish
  5. After the function is published, click Version in the right-side navigation pane of the configuration tab to view the publishing record. You can also click Version Details or Roll Back in the Actions column.

What to do next

You can use the published function as a prefilter or a post-filter for an API. For more information, see Create and use Python functions as a filter and Create an Aviator function and use the Aviator function as a filter.