/// <summary> /// Makes a REST request and stores the result inside of the APIData object APIResult property. /// Check the returned bool to see if it was successful. /// </summary> /// <param name="anonURI">Delegated function containing URI to be formatted.</param> /// <param name="arguments">Arguments for formatting anonURI</param> /// <returns>bool</returns> public bool obtainAPIresults(uriArgs anonURI, params string[] arguments) { try { initRequest(); _APIResult = makeRESTrequest(anonURI(arguments)); return true; } catch (Exception e) { errorLog(e); return false; } }
/// <summary> /// Makes a REST request and stores the result inside of the APIData object APIResult property. /// Check the returned bool to see if it was successful. /// </summary> /// <param name="anonURI">Delegated function containing URI to be formatted.</param> /// <param name="arguments">Arguments for formatting anonURI</param> /// <returns>bool</returns> public bool obtainAPIresults(uriArgs anonURI, params string[] arguments) { try { initRequest(); _APIResult = makeRESTrequest(anonURI(arguments)); return(true); } catch (Exception e) { errorLog(e); return(false); } }
private void btnGetAll_Click(object sender, EventArgs e) { APIData ad = qrl.apiInformation["Get all"]; uriArgs noargument = x => ad.APIuri; bool check = ad.obtainAPIresults(noargument, null); if (check) { outputAllJson(ad.APIResult); } else { txtResults.Text = "Error"; } }
private void btnCA_Click(object sender, EventArgs e) { APIData ad = qrl.apiInformation["Search"]; string[] args = { "ca" }; uriArgs arguments = x => String.Format(ad.APIuri, x[0]); bool check = ad.obtainAPIresults(arguments, args); if (check) { outputAllJson(ad.APIResult); } else { txtResults.Text = "Error"; } }
private void btnIT_Click(object sender, EventArgs e) { APIData ad = qrl.apiInformation["Get iso code"]; string[] args = { "iso2code", "IT" }; uriArgs arguments = x => String.Format(ad.APIuri, x[0], x[1]); bool check = ad.obtainAPIresults(arguments, args); if (check) { outputJson(ad.APIResult); } else { txtResults.Text = "Error"; } }