{"id":9,"date":"2015-07-24T10:11:03","date_gmt":"2015-07-24T15:11:03","guid":{"rendered":"http:\/\/www.teamdesk.net\/blog\/2015\/07\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/"},"modified":"2021-09-15T03:52:07","modified_gmt":"2021-09-15T08:52:07","slug":"rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i","status":"publish","type":"post","link":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/","title":{"rendered":"Rendering TeamDesk data on a web page using REST API, Part I"},"content":{"rendered":"<p>For a long time <a href=\"http:\/\/www.teamdesk.net\">TeamDesk<\/a> had a <a href=\"https:\/\/en.wikipedia.org\/wiki\/SOAP\">SOAP API<\/a> to support client-server exchange between the database and applications, however its use on web pages was fairly complicated.<\/p>\n<p>First of all, enabling support for SOAP interchange in JavaScript requires fair amount of extra code \u2013 we&#8217;ve fit into 1500+ lines. Next problem is a browsers security limitation on requests across domain boundaries \u2013 that&#8217;s when the web page located on your server calls TeamDesk for a data \u2013 Internet Explorers up to version 10 were disabling the use in such scenario. However, with introduction of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer\">REST API<\/a> all of these problems are solved.<\/p>\n<p>While some browsers prevent programmatic access to resources located in another domain, you can still get access to those resources in <a href=\"https:\/\/en.wikipedia.org\/wiki\/JSON\">JSON<\/a> format by using HTML &lt;SCRIPT&gt; tags \u2013 the trick is called <a href=\"https:\/\/en.wikipedia.org\/wiki\/JSONP\">JSONP<\/a>. The idea is based on a fact JSON data is represented in a valid JavaScript syntax; the trick wraps the data with function call syntax, thus generating the code that will be executed when the data is loaded. Let&#8217;s see how it works.<\/p>\n<p><!--more--><\/p>\n<p>Here is an URL to retrieve Id, Text and URL columns from top 5 recently modified records in a table Test from API Test application:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/secure\/api\/v2\/21995\/B4B789F795F943B5A1CD0D27C12C8AAF\/Test\/select.json?top=5&amp;column=Id&amp;column=Text&amp;column=URL&amp;sort=Date%20Modified\/\/DESC\"><span style=\"background-color: white;\">https:\/\/www.teamdesk.net\/secure\/api\/v2\/21995\/B4B789F795F943B5A1CD0D27C12C8AAF\/Test\/select.json?top=5&amp;column=Id&amp;column=Text&amp;column=URL<\/span>&amp;sort=Date%20Modified\/\/DESC <\/a><\/p>\n<p>In order to consume the data via &lt;SCRIPT&gt; tag you&#8217;ll need to write a little function and include this URL with an extra parameter:<\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<\/span><\/span><\/span><\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">function<span style=\"color: black;\"> onDataReady(apiResult) {<br \/>\n<\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\"><span style=\"color: green;\">\u00a0\u00a0\u00a0\u00a0\/\/ apiResult parameter has the data, do some work here<br \/>\n<\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">}<br \/>\n<\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;\/<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<\/span><\/span><\/span><\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt;\"><span style=\"background-color: white;\">&lt;<span style=\"color: maroon;\">script<span style=\"color: black;\"> <span style=\"color: red;\">src<span style=\"color: blue;\">=&#8221;https:\/\/www.teamdesk.net\/secure\/api\/v2\/&#8230;Modified\/\/DESC&amp;<strong><em>callback=onDataReady<\/em><\/strong>&#8220;&gt;&lt;\/<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>Order matters: the function must be defined prior to referencing the script. Once API data is loaded, the function will be invoked with the data passed as a function parameter.<\/p>\n<p>Now, let&#8217;s do some things with the data, for example, let&#8217;s render the table with the data on a page.<\/p>\n<p>While you can iterate over returned data and programmatically build the piece of HTML, we&#8217;ve found excellent <a href=\"http:\/\/mustache.github.io\/\">Mustache<\/a> template engine quite useful. It&#8217;s open source, it&#8217;s fast and it&#8217;s compact \u2013 less than 3Kb when compressed over the wire.<\/p>\n<p>With Mustache you can define table template as:<\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;<span style=\"color: maroon;\">table<span style=\"color: black;\"> <span style=\"color: red;\">id<span style=\"color: blue;\">=&#8221;template&#8221;&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">Id<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">Text<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">URL<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211;<span style=\"color: black;\"><strong>{{<span style=\"color: darkgreen;\">#Records<span style=\"color: black;\">}}<\/span><\/span><\/strong><span style=\"color: darkgreen;\">&#8211;&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">Id<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">Text<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">a<span style=\"color: black;\"> <span style=\"color: red;\">href<span style=\"color: blue;\">=&#8221;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">URL<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&#8220;&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">URL<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">a<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211;<span style=\"color: black;\"><strong>{{<span style=\"color: darkgreen;\">\/Records<span style=\"color: black;\">}}<\/span><\/span><\/strong><span style=\"color: darkgreen;\">&#8211;&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;\/<span style=\"color: maroon;\">table<span style=\"color: blue;\">&gt;<\/span><\/span><\/span><\/p>\n<p>and invoke template engine as soon as you get the data into the function. The page that renders the table is 25 lines of HTML and JavaScript including comments:<\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;<span style=\"color: maroon;\">html<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;<span style=\"color: maroon;\">head<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">title<span style=\"color: blue;\">&gt;<span style=\"color: black;\">Rendering Test<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">title<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;\/<span style=\"color: maroon;\">head<span style=\"color: blue;\">&gt;<\/span><\/span><\/span><\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;<span style=\"color: maroon;\">body<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211; table template &#8211;&gt;<br \/>\n<\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">table<span style=\"color: black;\"> <span style=\"color: red;\">id<span style=\"color: blue;\">=&#8221;template&#8221;<span style=\"color: black;\"> <span style=\"color: red;\">border<span style=\"color: blue;\">=&#8221;1&#8243;<span style=\"color: black;\"> <span style=\"color: red;\">cellpadding<span style=\"color: blue;\">=&#8221;4&#8243;<span style=\"color: black;\"> <span style=\"color: red;\">cellspacing<span style=\"color: blue;\">=&#8221;0&#8243;&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">Id<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">Text<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;<span style=\"color: black;\">URL<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">th<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211;<span style=\"color: black;\"><strong>{{<span style=\"color: darkgreen;\">#Records<span style=\"color: black;\">}}<\/span><\/span><\/strong><span style=\"color: darkgreen;\">&#8211;&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">Id<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">Text<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;<span style=\"color: maroon;\">a<span style=\"color: black;\"> <span style=\"color: red;\">href<span style=\"color: blue;\">=&#8221;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">URL<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&#8220;&gt;<span style=\"color: black;\"><strong>{{<\/strong><span style=\"color: purple;\">URL<span style=\"color: black;\"><strong>}}<\/strong><span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">a<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">td<span style=\"color: blue;\">&gt;&lt;\/<span style=\"color: maroon;\">tr<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211;<span style=\"color: black;\"><strong>{{<span style=\"color: darkgreen;\">\/Records<span style=\"color: black;\">}}<\/span><\/span><\/strong><span style=\"color: darkgreen;\">&#8211;&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">table<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: darkgreen;\">&lt;!&#8211; scripts &#8211;&gt;<br \/>\n<\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">script<span style=\"color: black;\"> <span style=\"color: red;\">src<span style=\"color: blue;\">=&#8221;\/\/cdnjs.cloudflare.com\/ajax\/libs\/mustache.js\/2.1.3\/mustache.min.js&#8221;&gt;&lt;\/<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">function<span style=\"color: black;\"> onDataReady(apiResult) {<br \/>\n<\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">var<span style=\"color: black;\"> template = document.getElementById(<span style=\"color: #a31515;\">&#8220;template&#8221;<span style=\"color: black;\">);<br \/>\n<\/span><\/span><\/span><\/span><\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0template.innerHTML = Mustache.render(template.innerHTML, { Records: apiResult });<br \/>\n<\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br \/>\n<\/span><span style=\"color: black; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: blue;\">&lt;\/<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><span style=\"color: darkgreen; font-family: Consolas; font-size: 9pt; background-color: white;\">\u00a0\u00a0\u00a0\u00a0&lt;!&#8211; API Call &#8211;&gt;<br \/>\n<span style=\"color: blue;\">\u00a0\u00a0\u00a0\u00a0&lt;<span style=\"color: maroon;\">script<span style=\"color: black;\"> <span style=\"color: red;\">src<span style=\"color: blue;\">=&#8221;https:\/\/www.teamdesk.net\/secure\/api\/v2\/21995\/B4B789F795F943B5A1CD0D27C12C8AAF\/Test\/select.json?top=5&amp;column=Id&amp;column=Text&amp;column=URL&amp;sort=Date%20Modified\/\/DESC&amp;callback=onDataReady&#8221;&gt;&lt;\/<span style=\"color: maroon;\">script<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt; background-color: white;\">&lt;\/<span style=\"color: maroon;\">body<span style=\"color: blue;\">&gt;<br \/>\n<\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt;\"><span style=\"background-color: white;\">&lt;\/<span style=\"color: maroon;\">html<span style=\"color: blue;\">&gt;<\/span><\/span><\/span> <\/span><\/p>\n<p>And here is a result of template rendering:<\/p>\n<div>\n<table style=\"border-collapse: collapse;\" border=\"0\">\n<colgroup>\n<col style=\"width: 55px;\" \/>\n<col style=\"width: 147px;\" \/>\n<col style=\"width: 326px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">\n<p style=\"text-align: center;\"><strong>Id<\/strong><\/p>\n<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">\n<p style=\"text-align: center;\"><strong>Text<\/strong><\/p>\n<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">\n<p style=\"text-align: center;\"><strong>URL<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">1<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">Test 1<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\"><a href=\"http:\/\/www.teamdesk.net\/\">http:\/\/www.teamdesk.net<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">114<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">Test File<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\"><a href=\"http:\/\/www.teamdesk.net\/\">http:\/\/www.teamdesk.net<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">115<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">Test File<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\"><a href=\"http:\/\/www.teamdesk.net\/\">http:\/\/www.teamdesk.net<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">117<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">Test Create<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\"><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">116<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\">Test 1<\/td>\n<td style=\"border: solid 0.5pt; padding: 4px;\" valign=\"middle\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a long time TeamDesk had a SOAP API to support client-server exchange between the database and applications, however its use on web pages was fairly complicated. Now with introduction of REST API all of these problems have been solved.<\/p>\n","protected":false},"author":4,"featured_media":2470,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[220,221,219],"class_list":["post-9","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-tricks","tag-json","tag-jsonp","tag-rest-api"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Rendering TeamDesk data on a web page using REST API, Part I<\/title>\n<meta name=\"description\" content=\"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rendering TeamDesk data on a web page using REST API, Part I\" \/>\n<meta property=\"og:description\" content=\"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/\" \/>\n<meta property=\"og:site_name\" content=\"TeamDesk Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-24T15:11:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-15T08:52:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png\" \/>\n\t<meta property=\"og:image:width\" content=\"959\" \/>\n\t<meta property=\"og:image:height\" content=\"382\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kirill Bondar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirill Bondar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/\"},\"author\":{\"name\":\"Kirill Bondar\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"headline\":\"Rendering TeamDesk data on a web page using REST API, Part I\",\"datePublished\":\"2015-07-24T15:11:03+00:00\",\"dateModified\":\"2021-09-15T08:52:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/\"},\"wordCount\":757,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/07\\\/Rendering.png\",\"keywords\":[\"JSON\",\"JSONP\",\"Rest API\"],\"articleSection\":[\"Tips &amp; Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/\",\"name\":\"Rendering TeamDesk data on a web page using REST API, Part I\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/07\\\/Rendering.png\",\"datePublished\":\"2015-07-24T15:11:03+00:00\",\"dateModified\":\"2021-09-15T08:52:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\"},\"description\":\"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/07\\\/Rendering.png\",\"contentUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/07\\\/Rendering.png\",\"width\":959,\"height\":382,\"caption\":\"HTML Rendering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rendering TeamDesk data on a web page using REST API, Part I\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\",\"name\":\"TeamDesk Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/22c4c05bd657513c8b00122fa364c8d2\",\"name\":\"Kirill Bondar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g\",\"caption\":\"Kirill Bondar\"},\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/author\\\/kirill-bondar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rendering TeamDesk data on a web page using REST API, Part I","description":"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/","og_locale":"en_US","og_type":"article","og_title":"Rendering TeamDesk data on a web page using REST API, Part I","og_description":"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.","og_url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/","og_site_name":"TeamDesk Blog","article_published_time":"2015-07-24T15:11:03+00:00","article_modified_time":"2021-09-15T08:52:07+00:00","og_image":[{"width":959,"height":382,"url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png","type":"image\/png"}],"author":"Kirill Bondar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirill Bondar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#article","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/"},"author":{"name":"Kirill Bondar","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"headline":"Rendering TeamDesk data on a web page using REST API, Part I","datePublished":"2015-07-24T15:11:03+00:00","dateModified":"2021-09-15T08:52:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/"},"wordCount":757,"commentCount":0,"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png","keywords":["JSON","JSONP","Rest API"],"articleSection":["Tips &amp; Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/","url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/","name":"Rendering TeamDesk data on a web page using REST API, Part I","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#primaryimage"},"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png","datePublished":"2015-07-24T15:11:03+00:00","dateModified":"2021-09-15T08:52:07+00:00","author":{"@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2"},"description":"How to support client-server exchange between a database and apps. TeamDesk data rendering on a web page using REST API and JSON.","breadcrumb":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#primaryimage","url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png","contentUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2015\/07\/Rendering.png","width":959,"height":382,"caption":"HTML Rendering"},{"@type":"BreadcrumbList","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/rendering-teamdesk-data-on-a-web-page-using-rest-api-part-i\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.teamdesk.net\/blog\/"},{"@type":"ListItem","position":2,"name":"Rendering TeamDesk data on a web page using REST API, Part I"}]},{"@type":"WebSite","@id":"https:\/\/www.teamdesk.net\/blog\/#website","url":"https:\/\/www.teamdesk.net\/blog\/","name":"TeamDesk Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.teamdesk.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/22c4c05bd657513c8b00122fa364c8d2","name":"Kirill Bondar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc5bc844095b5753ccc73c589c028bf16615674f289668146bbd59205a08a52d?s=96&d=mm&r=g","caption":"Kirill Bondar"},"url":"https:\/\/www.teamdesk.net\/blog\/author\/kirill-bondar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":2,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":2473,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/9\/revisions\/2473"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media\/2470"}],"wp:attachment":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}