How can I change the disk of the recording server?is there an API to get the retention time for video recording?

ConfigurationAPI sample might be helpful for you, please see this link –

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/configapiclient/readme.html&tree=tree_2.html

You change the disk by creating a new Storage, or by modifying an existing storage. This can be done in the Management Client or using Configuration API