コード例 #1
0
        public static void QueryAPIAndPrintResult(string term, double latitude, double longitude)
        {
            var client = new YelpAPIClient();


            JObject response = client.Search(term, latitude, longitude);

            JArray businesses = (JArray)response.GetValue("businesses");

            if (businesses.Count == 0)
            {
                //Console.WriteLine("No businesses for {0} in {1} found.", term, location);
                return;
            }

            string business_id = (string)businesses[0]["id"];

            Console.WriteLine(
                "{0} businesses found, querying business info for the top result \"{1}\"...",
                businesses.Count,
                business_id
                );

            response = client.GetBusiness(business_id);

            Console.WriteLine(String.Format("Result for business {0} found:", business_id));
            Console.WriteLine(response.ToString());
        }
コード例 #2
0
        // GET: API
        public JObject NearbyRestaurants(double latitude, double longitude)
        {
            YelpAPIClient client = new YelpAPIClient();

            return(client.Search("food", latitude, longitude));
        }