To help you use the Tableau Metadata API, Tableau provides sample scripts that you can download and modify for your purposes.
The sample scripts can be downloaded from GitHub: https://github.com/tableau/metadata-api-samples.
You can also download the Metadata API schema files from here: