Last active
August 29, 2015 14:09
-
-
Save shawngiese/0314216a6ed8e3fb766d to your computer and use it in GitHub Desktop.
Using RESTful queries to extract data for display in an HTML list
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
| </head> | |
| <script type="text/javascript" language="JavaScript"> | |
| var user = "gazetteer"; | |
| var pass = "Demo1234" | |
| var uriLogin = "http://restapitest.actuate.com:5000/ihub/v1/login"; | |
| var uriSearch = "http://restapitest.actuate.com:5000/ihub/v1/files"; | |
| var uriData = "http://restapitest.actuate.com:5000/ihub/v1/dataobject/"; | |
| var auth = ""; | |
| var fileid = ""; | |
| $.post(uriLogin, {"username" : user, "password" : pass}, function(data) {searchFile(data)}) | |
| function searchFile(result) { | |
| auth = result.AuthId; | |
| var search = uriSearch + "?search=%2FResources%2FClassic%20Models.data&authId=" + auth; | |
| $.getJSON( search, function(response){getData(response)}); | |
| } | |
| function getData(result) { | |
| fileid = result.ItemList.File[0].Id; | |
| var search = uriData + fileid + "/Customers?column=CUSTOMERNAME&sortColumn=CUSTOMERNAME&authId=" + auth; | |
| $.getJSON( search, function(response){buildList(response)}); | |
| } | |
| function buildList(result) { | |
| $.each(result.data, function(i, item) { | |
| $('ul').append('<li>' + item.CUSTOMERNAME + '</li>'); | |
| }); | |
| }; | |
| </script> | |
| <body> | |
| <ul></ul> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment