Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartClient REST/JSON example

    I am evaluating SmartClient as our framework of choice for our REST/JSON API web app. I downloaded the LGPL 8.1 smartclient framework and reading through the docs and quick start, I can't find any examples of how to simply call a REST API with a JSON data payload and listen for the response.

    Is there an example? Also are there SmartClient tutorials available somewhere?

    #2
    Take a CAREFUL look at this thread :

    http://forums.smartclient.com/showthread.php?t=16190

    Comment


      #3
      That thread references the use of SmartGWT. We want to use SmartClient, only the javascript/HTML portion of it. No use of Java whatsoever.

      We are deciding between SmartClient or ExtJS and ExtJS has a clear cut way of making AJAX RPC calls using a REST interface. I am looking for the same thing with SmartClient, not SmartGWT.

      Comment


        #4
        The class you're looking for is RestDataSource. Check the documentation and the feature explorer for details and examples, especially, the page named "Client-side Data Integration". The RestDataSource is highly customizable to adapt to your server, and many "databound components", like the ListGrid or the DynamicForm, will directly use your datasource with their own add, fetch, update, and remove REST methods.

        Comment


          #5
          Ok, I will give it a look. I am hitting walls here trying to find examples. All I am seeing are lots of Java based examples and my web app architecture is simply HTML/Javascript/CSS that makes xmlHttpRequests to a REST API.

          Caveat: I am a Flash/Flex developer being pushed into making our app "non-flash". So bear with me while I evaluate our options. One team at our company is using SmartGWT but not having Java experience, my team would prefer to use simple HTML/Javascript/CSS development.

          Comment


            #6
            Read that section in the Quickstart Guide.

            The formatting of the JSON response was NOT what I had expected, and it is critical that you get it right, including the outer response tag

            Code:
            {
                response: { status ....  }
            }
            not

            Code:
            {
                status .....
            }

            Comment


              #7
              We are returning custom JSON response packets, so that's not an issue. Sending custom JSON packets is. When I get further along, i will post my solution unless someone can post a solution before me ... which would be very appreciated.

              Comment

              Working...
              X