Suppose i have following MVC 3 REST API Action Method:
[HttpGet]
[ActionName("List")]
public ActionResult PageInsightsGet(string Uniqueid)
{
ActionResult actionResult=null;
try
{
switch (int.Parse(Request.QueryString["Query"]))
{
case 1:
Paging<FacebookStatistics> JsonObject = new Paging<FacebookStatistics>(new List<FacebookStatistics>(), 0);
List<FacebookStatistics> results = FacebookUtility.RetrievStoredInsights(Uniqueid, Request.QueryString["QueryType"]);
JsonObject = new Paging<FacebookStatistics>(results, results.Count);
actionResult = this.View("", JsonObject);
break;
case 2:
break;
case 3:
break;
}
}
catch (Exception ex)
{
actionResult = this.View("", new ErrorDetail { Description = ex.Message, DebugInformation = ex.StackTrace }, HttpStatusCode.BadRequest);
}
return actionResult;
}
i open chrome and hit the service using following url:
http://localhost:9265/FacebookInsigh...t=json&query=1
and the return JSON is :
{"Data":[{"FacebookFans":"49","NewFans":"0","NewFansPercentage":"0.0","Visits":"0","VisitsPercentage":"0.0","PageViews":"6","UniqueVisitors":"2","uniqueid":"201118776571940","MembersImagespath":"Images/DashBoardNewLook/equal.png","pageviewsImagespath":"Images/DashBoardNewLook/equal.png","MembersColor":"Yellow","PageViewsColor":"Yellow","PageLikesAdd":"0","PageComments":"1","PageCommentspercentage":"0.0","PageCommentaddImagePath":"Images/DashBoardNewLook/equal.png","PageCommentaddColor":"Yellow","PageFanAdds":"0","PageFansRemoves":"0","PageStreamViews":"141","PageVideos":"0","PageVideosPlays":"0","PageViewsLogin":"6","PageViewsLogout":"0","PageWallPosts":"0"}],"TotalRecords":1}
which is cool , but i need an example how to call this REST Service using a Ext:Store, where i can pass parameters and query strings if possible.
if you wonder how i did the JSON directly im aleardy build a frawework which intrrupt the ActionResult and depends on the query string Format i render the result .
Your urgent help is appreciated.