Hi @Haolan Ye - Advanced Threat Detection
can only be enable through the Azure Portal and Data Encryption
can only be enabled through the Azure Portal or via Azure CLI. The Azure CLI instructions are here: Data encryption for Azure Database for MySQL by using the Azure CLI
The entire Azure RESTful API Documentation Reference can be found: Azure REST API Reference and the MySQL specification is here: Azure Database for MySQL REST API
The Azure CLI Examples: Azure CLI samples for Azure Database for MySQL (Link) where the List and update configurations of an Azure Database for MySQL server using Azure CLI (Link) would be the CLI script to list and change server parameters.
As for a REST operations, the Server Configurations - Create Or Update and Database Configurations - Create Or Update endpoint will invoke the desired modification. You can use the Operations - List endpoint to list all available REST operations.
Neither Advanced Threat Detection nor Data Encryption can be enable via RESTful API but I have provided the information as a helpful means towards your automation efforts.