public static string SearchTerm(string request) { string urlBase = URL_BASE + "search_expression=" + request + "&method=foods.search"; FatSecretObj o = new FatSecretObj(); Uri url = new Uri(urlBase); string normalizedUrl, normalizedRequestParameters; string signature = o.GenerateSignature(url, consumerKey, consumerSecret, null, null, out normalizedUrl, out normalizedRequestParameters); string jsonString = GetQueryResponse(normalizedUrl, normalizedRequestParameters + "&" + FatSecretObj.OAUTH_SIGNATURE + "=" + HttpUtility.UrlEncode(signature)); return jsonString; }
public static string GetFood(string request) { string urlBase = URL_BASE + "method=food.get" + "&food_id=" + request + ""; FatSecretObj o = new FatSecretObj(); Uri url = new Uri(urlBase); string normalizedUrl, normalizedRequestParameters; string signature = o.GenerateSignature(url, consumerKey, consumerSecret, null, null, out normalizedUrl, out normalizedRequestParameters); string jsonString = GetQueryResponse(normalizedUrl, normalizedRequestParameters + "&" + FatSecretObj.OAUTH_SIGNATURE + "=" + HttpUtility.UrlEncode(signature)); /* Leaving this code in for now so I don't have to look up the process of writing JSON to a txt System.IO.File.WriteAllText(@"c:\\Users\\nickm\\Desktop\\Test\\Test2.txt", jsonString); */ return jsonString; }