/// <summary> /// The purpose of this method is to acquire the JSON file from RedCap using the RedCap API /// </summary> static void AcquireJSONAndMetaData() { //These lines are for looking at the secrets file and getting the info to make contact with the RedCap API var builder = new ConfigurationBuilder(); builder.AddUserSecrets <GetData>(); IConfigurationRoot Configuration = builder.Build(); var SelectedSecrets = Configuration.GetSection("COIReportDevinSecrets"); token = SelectedSecrets["OphthRealAPIToken"]; reportID = SelectedSecrets["OphthRealDevinReportID"]; apiURL = SelectedSecrets["APIURL"]; var redcap_api = new RedcapApi(apiURL); string[] metadataFields = { "clinicaldegree", "entity3", "state", "type3" }; //This is all of the RedCapData, including the data dictionary! RedCapResult = redcap_api.ExportReportsAsync(token, int.Parse(reportID), Redcap.Models.ReturnFormat.json).Result; MetaDataResult = redcap_api.ExportMetaDataAsync(token, Redcap.Models.ReturnFormat.csv, metadataFields).Result; }