When a person is desirous of obtaining the affidavit of another who is unwilling to make the same fully, the person may apply by petition to any officer competent to take depositions, stating the object for which the person desires the affidavit.