public HttpResponseMessage renewAllCerts() { int reqid; var jsonObject = new JObject(); var resp = new HttpResponseMessage(HttpStatusCode.OK); SqlLite sql = new SqlLite(); List <string> list = sql.certExpired(); for (var i = 0; i < list.Count; i++) { jsonObject.Add("Host" + i, list[i]); reqid = renewCert(list[i]); jsonObject.Add("reqid" + i, reqid); } resp.Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(jsonObject), System.Text.Encoding.UTF8, "application/json"); return(resp); }