You can learn various API techniques by using the Revit VSTA samples provided with the SDK.
Copy and open the following Revit project files from \Software Development Kit\Macro Samples\...:
Included in this RVT file are several document-level macros. In Revit, start the Macro Manager, select one of the document-level macros, and select Run. Note that when you open Revit_VSTA_Samples.rvt from the SDK, it may contain more samples than the ones shown in the following screen, and the macro methods may be named differently.
These macros have been preconfigured to run in Revit. In the Macro Manager, you can also select any of the VSTA sample macros, and click Edit to see the code created to run that sample. You can also select any of the VSTA sample macros and click Edit to see the code created to run that sample.
Revit VSTA application-level macro samples are provided with the SDK in \Software Development Kit\VSTA Samples\:
Copy these directories into C:\Program Files\Autodesk\Revit