Last active
October 11, 2023 21:52
-
-
Save azcoov/7835024 to your computer and use it in GitHub Desktop.
Example of calling the Nearby Now API with C#. View the API Integration page for more examples: http://servicepros.nearbynow.co/plugins/api-integration/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiSampleController : Controller | |
{ | |
private const string api = | |
"https://api.sidebox.com/plugin/heatmap?storefronttoken={0}&state={1}&city={2}&zoomlevel={3}&showmap={4}&techemail={5}&mapscrollwheel={6}&agent={7}&checkincount={8}&reviewcount={9}"; | |
private const string StorefrontToken = "get this from the Nearby Now admin site"; | |
public ActionResult NearbyNowReviews(String State, String City) | |
{ | |
var agent = Request.UserAgent; | |
var wc = new WebClient(); | |
ViewBag.NearbyNowContent = wc.DownloadString(String.Format(api, | |
HttpUtility.UrlEncode(StorefrontToken), | |
HttpUtility.UrlEncode(State), | |
HttpUtility.UrlEncode(City), | |
"", // zoomlevel | |
"", // showmap | |
"", // techemail | |
"", // mapscrollwheel | |
HttpUtility.UrlEncode(agent), | |
20, // checkincount | |
20) // reviewcount | |
); | |
return View(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiSampleController : Controller | |
{ | |
private const string api = | |
"https://api.sidebox.com/plugin/nearbyreviews?storefronttoken={0}&state={1}&city={2}&zoomlevel={3}&radius={4}&showmap={5}&techemail={6}&mapscrollwheel={7}&fblike={8}&fbcomment={9}&agent={10}&count={11}"; | |
private const string StorefrontToken = "get this from the Nearby Now admin site"; | |
public ActionResult NearbyNowReviews(String State, String City) | |
{ | |
var agent = Request.UserAgent; | |
var wc = new WebClient(); | |
ViewBag.NearbyNowContent = wc.DownloadString(String.Format(api, | |
HttpUtility.UrlEncode(StorefrontToken), | |
HttpUtility.UrlEncode(State), | |
HttpUtility.UrlEncode(City), | |
"", // zoomlevel | |
"", // radius | |
"", // showmap | |
"", // techemail | |
"", // mapscrollwheel | |
"", // fblike | |
"", // fbcomment | |
HttpUtility.UrlEncode(agent), | |
"") | |
); // count | |
return View(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiSampleController : Controller | |
{ | |
private const string api = | |
"https://api.sidebox.com/plugin/nearbyserviceareareviewcombo?storefronttoken={0}&state={1}&city={2}&zoomlevel={3}&radius={4}&showmap={5}&techemail={6}&mapscrollwheel={7}&fblike={8}&fbcomment={9}&agent={10}"; | |
private const string StorefrontToken = "get this from the Nearby Now admin site"; | |
public ActionResult NearbyNowReviews(String State, String City) | |
{ | |
var agent = Request.UserAgent; | |
var wc = new WebClient(); | |
ViewBag.NearbyNowContent = wc.DownloadString(String.Format(api, | |
HttpUtility.UrlEncode(StorefrontToken), | |
HttpUtility.UrlEncode(State), | |
HttpUtility.UrlEncode(City), | |
"", // zoomlevel | |
"", // radius | |
"", // showmap | |
"", // techemail | |
"", // mapscrollwheel | |
"", // fblike | |
"", // fbcomment | |
HttpUtility.UrlEncode(agent)) | |
); // count | |
return View(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApiSampleController : Controller | |
{ | |
private const string api = | |
"https://api.sidebox.com/plugin/nearbyservicearea?storefronttoken={0}&state={1}&city={2}&zoomlevel={3}&radius={4}&showmap={5}&techemail={6}&mapscrollwheel={7}&fblike={8}&fbcomment={9}&agent={10}&count={11}"; | |
private const string StorefrontToken = "get this from the Nearby Now admin site"; | |
public ActionResult NearbyNowReviews(String State, String City) | |
{ | |
var agent = Request.UserAgent; | |
var wc = new WebClient(); | |
ViewBag.NearbyNowContent = wc.DownloadString(String.Format(api, | |
HttpUtility.UrlEncode(StorefrontToken), | |
HttpUtility.UrlEncode(State), | |
HttpUtility.UrlEncode(City), | |
"", // zoomlevel | |
"", // radius | |
"", // showmap | |
"", // techemail | |
"", // mapscrollwheel | |
"", // fblike | |
"", // fbcomment | |
HttpUtility.UrlEncode(agent), | |
"") | |
); // count | |
return View(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<--Add the required css to your Head--> | |
<link href="https://d2gwjd5chbpgug.cloudfront.net/v4.2/css/nnplugin.min.css" rel="stylesheet" type="text/css" /> | |
<--Somewhere in your page, ender the plugin content in your view using the following code:!--> | |
@Html.Raw(ViewBag.NearbyNowContent) | |
<--Make sure you include Query. Any flavor is fine--> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<--Make sure you include the required Nearby Now Heatmap script--> | |
<script src="https://d2gwjd5chbpgug.cloudfront.net/v3/scripts/heatmap.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment