All Products
Search
Document Center

DataWorks:Configuring an API Filter (Function)

Last Updated:Dec 05, 2024

DataService Studio allows you to create, test, and publish a function. Then, you can associate the function with an API and use the function as a filter to process the request parameters or responses of the API. This topic provides an overview of functions.

Limits

  • Before you can use a function as a filter for an API, you must activate DataWorks Basic Edition or an advanced edition.

  • The feature that allows you to use a Python function as a filter for an API is being optimized. You cannot create, clone, or publish a Python function. If you want to use a function as a filter for an API, we recommend that you use an Aviator function. For more information, see Create an Aviator function.

Precautions

  • For the same API, the function that you use as the prefilter and the function that you use as the post-filter must be of the same type. You cannot use different types of functions as filters for an API.

  • To ensure data security and function performance, you must use an exclusive resource group for DataService Studio to run an Aviator function.

    • When you modify or test a function, you must associate an exclusive resource group for DataService Studio with the function. For more information, see Create a function.

    • If you enable the filter feature for an API and associate a function with the API when you develop the API, you must associate an exclusive resource group for DataService Studio with the API. For more information, see Create an API by using the codeless UI.

Overview

DataService Studio allows you to create, test, and publish an Aviator function or a Python function. Then, you can associate the function with an API, and use the function as a filter to process the request parameters or responses of the API to perform complex queries based on your business requirements. For more information, see Use a function as a filter for an API.

  • If you use a function as a prefilter for an API, the function preprocesses the request parameters of the API when the API is called.

  • If you use a function as a post-filter for an API, the function processes and reconstructs the responses of the API when the API is called.

For information about the sample code that shows how to use an Aviator function as a filter for an API in common scenarios, see Best practices of using Aviator functions as filters.