[CLOSED] Rest api.

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Rest api.

    we are in the process of define a REST API for our application , do the EXT.NET compatible with REST , i mean the STORE object.
    Last edited by Daniil; Aug 02, 2011 at 1:55 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I see the thread's title and the question have the different meanings.

    we are in the process of define a REST API for our application , do the EXT.NET compatible with REST , i mean the STORE object.
    Please see
    https://examples1.ext.net/#/GridPanel/Restful/Overview/
  3. #3

    Thanks Daniel , but i dont think u got my point

    im building a REST Service using MVC 3.0 where each resource will have a get, post,delete,put action method and i need to know if EXT store can resolve such calls, since all example here is about Ws.* web services REST which is calling web services using WS and return JSON,my action methods will receive a http request of type get,post,delete,put only

    my question is do ext.net store can resolve this and how, and if you provide me an example i will greatfull.
  4. #4
    HttpProxy has RestAPI property
    <RestAPI CreateUrl="/User/Create" CreateMethod="POST"  />
  5. #5

    thanks validemer,but i need additional help.

    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.
  6. #6

    i reach for good point, but i still have an issue.

    i create ASPX file and add following store:
    <ext:Store ID="FacebookInsightsStore" runat="server" ShowWarningOnFailure="false" Restful="true">
            <Proxy>
                <ext:HttpProxy DisableCaching="true" Json="true" AutoDataBind="true">
                 <RestAPI AutoDataBind="true"
                    ReadMethod="GET" />
                </ext:HttpProxy>
            </Proxy>
            <Reader>
                <ext:JsonReader Root="d.Data" TotalProperty="d.TotalRecords">
                    <Fields>
                        <ext:RecordField Name="FacebookFans" />
                        <ext:RecordField Name="NewFans" />
                        <ext:RecordField Name="NewFansPercentage" />
                        <ext:RecordField Name="Visits" />
                        <ext:RecordField Name="VisitsPercentage" />
                        <ext:RecordField Name="PageViews" />
                        <ext:RecordField Name="UniqueVisitors" />
                        <ext:RecordField Name="uniqueid" />
                        <ext:RecordField Name="MembersImagespath" />
                        <ext:RecordField Name="pageviewsImagespath" />
                        <ext:RecordField Name="MembersColor" />
                        <ext:RecordField Name="PageViewsColor" />
                        <ext:RecordField Name="PageComments" />
                        <ext:RecordField Name="PageCommentspercentage" />
                        <ext:RecordField Name="PageCommentaddImagePath" />
                        <ext:RecordField Name="PageCommentaddColor" />
                        <ext:RecordField Name="PageFanAdds" />
                        <ext:RecordField Name="PageFansRemoves" />
                        <ext:RecordField Name="PageLikesAdd" />
                        <ext:RecordField Name="PageStreamViews" />
                        <ext:RecordField Name="PageVideos" />
                        <ext:RecordField Name="PageVideosPlays" />
                        <ext:RecordField Name="PageViewsLogin" />
                        <ext:RecordField Name="PageViewsLogout" />
                        <ext:RecordField Name="PageWallPosts" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <Listeners>
                <BeforeLoad Handler="this.loading=false;" />
                <LoadException Handler="if (response.responseText=='{&quot;d&quot;:null}') { alert('Grid is  empty!'); }" />
                <Load Handler="this.loading=false;" />
            </Listeners>
        </ext:Store>
    and add following code to the code behind:

      (FacebookInsightsStore.Proxy.Proxy as HttpProxy).Url = "http://facebookapi";
                (FacebookInsightsStore.Proxy.Proxy as HttpProxy).RestAPI.ReadUrl = "/FacebookInsights/201118776571940?format=json&Query=1";
    The problem is the EXT.NET generate following url which i sniffer from fiddler:

    http://localhost/FacebookInsights/201118776571940?format=json&Query=1&_dc=1313536698930
    how i can inform the store that the service is not include under the website , which the case i will have , where i will create a separeted website or virtual directory under IIS which host the service , your urgent help really need , i feel im almost there but i need a little help.
  7. #7
    HttpProxy cannot perform cross domain requests (it is limitation of ajax request of the browser), ajax request can work with same domain only
  8. #8

    the problem still appearing even i use virtual directory

    thanks Vladimir,

    even when i use a virtual directory under my site(same domain) , the problem still appear where the generating url still wrong:

    The code:
              (FacebookInsightsStore.Proxy.Proxy as HttpProxy).Url = "http://localhost/FaceBookAPI";
              (FacebookInsightsStore.Proxy.Proxy as HttpProxy).RestAPI.ReadUrl = "/FacebookInsights/201118776571940?format=json&Query=1";
    The URL:
    http://localhost:9265/FacebookInsights/201118776571940?format=json&query=1
    do i have to set additional parameters or store option.

    also i wana share with you a thread from sencha site forum:
    http://www.sencha.com/forum/showthre...ata.Connection
    http://www.java2s.com/Code/JavaScrip...remotedata.htm

    cant you employ the concept to EXT.NET.

    also i wonder how facebook developers build an Javascript SDK to call their Graph API which is hosted on a separated domain of https://graph.facebook.com


    your urgent help really appreciated.
  9. #9
    For two documents to be considered to have the same origin, the protocol (http/https), the domain and the port (the default 80 or :xx) have to be indentical. So, you cannot use ajax request against a different port also.

    And ReadUrl is not mixed with Url property
  10. #10

    thanks vladimer.

    i will try this and update you , but im really wonder about following:

    also i wana share with you a thread from sencha site forum:
    http://www.sencha.com/forum/showthre...ata.Connection
    http://www.java2s.com/Code/JavaScrip...remotedata.htm

    cant you employ the concept to EXT.NET.

    also i wonder how facebook developers build an Javascript SDK to call their Graph API which is hosted on a separated domain of https://graph.facebook.com
    Last edited by geoffrey.mcgill; Aug 18, 2011 at 3:27 AM.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] REST with WCF - part 2
    By daneel in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 14, 2011, 2:40 PM
  2. [CLOSED] REST with WCF and Ext.NET 1.0
    By daneel in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 11, 2011, 10:34 AM
  3. [CLOSED] EventStore and REST API
    By craig2005 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 04, 2011, 3:19 PM
  4. [CLOSED] [1.0] Store and REST
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Feb 28, 2010, 4:19 AM
  5. [CLOSED] [1.0] REST question
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Nov 30, 2009, 12:48 PM

Posting Permissions