AnsweredAssumed Answered

Consume a external JSon

Question asked by lgonzalez on Nov 5, 2014
Hello everyone,

Well, i want to consume a external json, and put the data into a dashlet

Here it's the code, if you can help i realy appreaciate


file HelloWorld.get.html.ftl
<#assign el = args.htmlid>

<div class="hello user dashlet">
        <div class="title" id="greeting_div">Helloworld Dashlet </div>
                <div class="body" id ="$(el)_result">
                        <h2> ${greeting} ${} </h2>
file HelloWorld.get.desc.xml

        <shortname>Hello World Dashlet </shortname>
        <description>Display Greetings</description>
        <format default="json">extension</format>


file HelloWorld.get.json.ftl


file HelloWorld.get.js
function main()
        model.greeting = "Welcome"
        model.user =

        var uri = "http://localhost/sietApi/index.php/api/example/user/id/1/format/json",
         connector = remote.connect("http"),
         result = connector.get(uri);
      if (result.status == status.STATUS_OK)
         var td = eval("(" + result.response + ")");
         model.user = td