{"id":234,"date":"2016-09-30T10:09:36","date_gmt":"2016-09-30T10:09:36","guid":{"rendered":"http:\/\/smart.nettingbt.com\/\/?page_id=234"},"modified":"2018-01-18T17:29:37","modified_gmt":"2018-01-18T17:29:37","slug":"quickstart","status":"publish","type":"page","link":"https:\/\/www.smartdatasystem.es\/it\/quickstart\/","title":{"rendered":"Quickstart"},"content":{"rendered":"<p>[vc_row type=&#8221;vc_default&#8221; css=&#8221;.vc_custom_1479464260142{margin-top: -50px !important;}&#8221;][vc_column width=&#8221;1\/4&#8243;]<div class=\"ult_row_spacer\"><div class=\"ult-sticky-anchor\"><div class=\"ult-sticky-section ult-sticky \"  data-gutter= '50' data-stick_behaviour= 'stick_with_scroll_row'  data-sticky_position= 'top' data-mobile='no' data-support='no'>[vc_empty_space height=&#8221;55px&#8221;][vc_row_inner css=&#8221;.vc_custom_1476983527217{background-color: #424242 !important;border-radius: 15px !important;}&#8221;][vc_column_inner][vc_empty_space height=&#8221;10px&#8221;][vc_column_text]<\/p>\n<section id=\"presscore-custom-menu-1-2\" class=\"widget widget_presscore-custom-menu-1\">\n<div class=\"widget-title\"><span style=\"color: #ffffff;\">QUICKSTART<\/span><\/div>\n<ul class=\"custom-menu\">\n<li class=\"menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-has-children menu-item-462 act first has-children\"><a href=\"#overview\">Overview<\/a><\/li>\n<li class=\"menu-item menu-item-type-custom menu-item-object-custom current-menu-item current-menu-ancestor menu-item-has-children menu-item-464 act has-children\"><a href=\"#connectadevice\">Connect a Device<\/a><\/li>\n<li class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-465 first\"><a href=\"#integrate\">Integrate an Application<\/a><\/li>\n<\/ul>\n<\/section>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;20px&#8221;][\/vc_column_inner][\/vc_row_inner]<\/div><div class=\"ult-space\"><\/div><\/div><\/div>[\/vc_column][vc_column width=&#8221;3\/4&#8243; css=&#8221;.vc_custom_1476983822756{margin-left: 40px !important;border-left-width: 1px !important;padding-left: 40px !important;border-left-color: #c4c4c4 !important;border-left-style: solid !important;}&#8221;][vc_column_text]<a id=\"overview\" name=\"overview\"><\/a>[\/vc_column_text][vc_custom_heading text=&#8221;QUICKSTART&#8221; font_container=&#8221;tag:h2|text_align:left|color:%23383838&#8243; google_fonts=&#8221;font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal&#8221;][vc_column_text]<\/p>\n<h4 class=\"vc_custom_heading\">Get started quickly with and overview of the components involved in a typical solutions and practical examples on how to connect a device and how to integrate an external system to the SDS Platform.<\/h4>\n<p>[\/vc_column_text][vc_custom_heading text=&#8221;Overview&#8221; font_container=&#8221;tag:h3|text_align:left|color:%23383838&#8243; google_fonts=&#8221;font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal&#8221;][vc_column_text]Before starting your project, you need to have a clear understanding of the components involved in your solution. The following questions will help you clarify what you may need.[\/vc_column_text]<div class=\"standard-number-list list-divider bullet-top\"><ol>\n<li><strong>Devices<\/strong><br \/>\nFrom where are you trying to retrieve information or what device will you send instructions to?<br \/>\nCommon examples are utilities meters, temperature sensors, doors lock\/unlock mechanisms, etc.<\/li>\n<li><strong>Connectivity<\/strong><br \/>\nDoes the device already has connectivity and allows to configure parameters to be sent, or do you need to provide connectivity through a gateway?<\/li>\n<li><strong>SDS Platform<\/strong>: Will you use the platform as the user interface to provide your solution or will you create or use and external system<\/li>\n<li><strong>External System<\/strong>: Will you develop your own external application or are you integrating a 3rd party system?<\/li>\n<\/ol>\n<\/div>[vc_column_text]<a id=\"connectadevice\" name=\"connectadevice\"><\/a>[\/vc_column_text][vc_row_inner][vc_column_inner][vc_empty_space height=&#8221;47px&#8221;][vc_separator][vc_empty_space height=&#8221;47px&#8221;][\/vc_column_inner][\/vc_row_inner][vc_custom_heading text=&#8221;Connect a Device&#8221; font_container=&#8221;tag:h3|text_align:left|color:%23383838&#8243; google_fonts=&#8221;font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal&#8221;][vc_column_text]In this example we will send a reading from a device to the platform through the Devices API. PHP has been used as scripting language, but you can select the language of your choice.[\/vc_column_text][vc_column_text][php]<\/p>\n<p>\/*<\/p>\n<p>This example sends a numerical measurement (10.5) from sensor<br \/>\nSENSOR001, owned by provider PROVIDER001, identified by token:<\/p>\n<p>79d2dfe9ea9af9dd015befebda62180673314c8abb8898d626c66959448cae0d<\/p>\n<p>And then prints the platform server reply.<\/p>\n<p>*\/<\/p>\n<p>$providername = &#8216;PROVIDER001&#8217;;<br \/>\n$sensorname = &#8216;SENSOR001&#8242;;<br \/>\n$token = &#8217;79d2dfe9ea9af9dd015befebda62180673314c8abb8898d626c66959448cae0d&#8217;;<\/p>\n<p>$value = &#8216;10.5&#8217;;<\/p>\n<p>$json = &#8216;{&#8220;observations&#8221;:[{&#8220;value&#8221;:&#8221;&#8216;.$value.'&#8221;}]}&#8217;;<\/p>\n<p>$api_request_url = &#8216;[DEVICES API URL]\/data\/&#8217;.$providername.&#8217;\/&#8217;.$sensorname;<\/p>\n<p>$ch = curl_init();<br \/>\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);<br \/>\ncurl_setopt($ch, CURLOPT_HEADER, TRUE);<br \/>\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, &#8216;PUT&#8217;);<br \/>\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $json);<br \/>\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array(&#8216;IDENTITY_KEY: &#8216;.$token,&#8217;Content-Type: application\/json&#8217;));<br \/>\ncurl_setopt($ch, CURLOPT_URL, $api_request_url);<\/p>\n<p>$api_response = curl_exec($ch);<\/p>\n<p>$api_response_info = curl_getinfo($ch);<\/p>\n<p>curl_close($ch);<\/p>\n<p>$api_response_header = trim(substr($api_response, 0, $api_response_info[&#8216;header_size&#8217;]));<\/p>\n<p>echo $api_response_header;<\/p>\n<p>[\/php][\/vc_column_text][vc_column_text][\/vc_column_text][vc_column_text]For more examples on devices integration please click <a href=\"http:\/\/www.sentilo.io\/xwiki\/bin\/view\/Sentilo.Community.Tutorials\/Tutorials\" target=\"_blank\" rel=\"noopener\">here.<\/a>[\/vc_column_text][vc_column_text]<a id=\"integrate\" name=\"integrate\"><\/a>[\/vc_column_text][vc_row_inner][vc_column_inner][vc_empty_space height=&#8221;47px&#8221;][vc_separator][vc_empty_space height=&#8221;47px&#8221;][\/vc_column_inner][\/vc_row_inner][vc_custom_heading text=&#8221;Integrate an Application &#8221; font_container=&#8221;tag:h3|text_align:left|color:%23383838&#8243; google_fonts=&#8221;font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal&#8221;][vc_empty_space height=&#8221;20px&#8221;][vc_column_text]Let\u2019s read some data from the temperature sensor we have just connected (see \u201cConnect Device\u201d) through the Applications API, and insert into an external database.[\/vc_column_text][vc_column_text][php]<\/p>\n<p>\/*<\/p>\n<p>This example gets the list of raw measurements sent by a temperature sensor, which ID is 5123, from 2016-10-10 00:00:00 UTC to 2016-10-11 00:00:00 UTC.<\/p>\n<p>The user who&#8217;s sending the request is identified by token:<\/p>\n<p>0a2fb1d34c30dab68c6cf36c7218b4b332059e19db35c6fc9f6c56fd30d0223d<\/p>\n<p>After the request, it prints the list as a HTML table.<\/p>\n<p>*\/<\/p>\n<p>$sensorid = &#8216;5123&#8217;;<\/p>\n<p>$begin = &#8216;1476057600&#8217;; \/\/ 2016-10-10 00:00:00 UTC<\/p>\n<p>$end = &#8216;1476144000&#8217;; \/\/ 2016-10-11 00:00:00 UTC<\/p>\n<p>$apiKey = &#8216;0a2fb1d34c30dab68c6cf36c7218b4b332059e19db35c6fc9f6c56fd30d0223d&#8217;;<\/p>\n<p>$api_request_url = &#8216;http:\/\/api.smartdatasystem.es\/v1\/measurements?sensorid=&#8217;.$sensorid.&#8217;&amp;begin=&#8217;.$begin.&#8217;&amp;end=&#8217;.$end;<\/p>\n<p>$ch = curl_init();<\/p>\n<p>curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);<\/p>\n<p>curl_setopt($ch, CURLOPT_HEADER, TRUE);<\/p>\n<p>curl_setopt($ch, CURLOPT_CUSTOMREQUEST, &#8216;GET&#8217;);<\/p>\n<p>curl_setopt($ch, CURLOPT_HTTPHEADER, array(&#8216;apiKey: &#8216;.$apiKey,&#8217;Content-Type: application\/json&#8217;));<\/p>\n<p>curl_setopt($ch, CURLOPT_URL, $api_request_url);<\/p>\n<p>$api_response = curl_exec($ch);<\/p>\n<p>$api_response_info = curl_getinfo($ch);<\/p>\n<p>$results = json_decode(trim(substr($api_response, $api_response_info[&#8216;header_size&#8217;])))-&gt;measurements;<\/p>\n<p>curl_close($ch);<\/p>\n<p>[\/php][\/vc_column_text][vc_row_inner][vc_column_inner][vc_empty_space height=&#8221;47px&#8221;][vc_separator][vc_empty_space height=&#8221;47px&#8221;][\/vc_column_inner][\/vc_row_inner][\/vc_column][\/vc_row]<\/p>","protected":false},"excerpt":{"rendered":"<p>[vc_row type=&#8221;vc_default&#8221; css=&#8221;.vc_custom_1479464260142{margin-top: -50px !important;}&#8221;][vc_column width=&#8221;1\/4&#8243;][\/vc_column][vc_column width=&#8221;3\/4&#8243; css=&#8221;.vc_custom_1476983822756{margin-left: 40px !important;border-left-width: 1px !important;padding-left: 40px !important;border-left-color: #c4c4c4 !important;border-left-style: solid !important;}&#8221;][vc_column_text][\/vc_column_text][vc_custom_heading text=&#8221;QUICKSTART&#8221; font_container=&#8221;tag:h2|text_align:left|color:%23383838&#8243; google_fonts=&#8221;font_family:Roboto%3A100%2C100italic%2C300%2C300italic%2Cregular%2Citalic%2C500%2C500italic%2C700%2C700italic%2C900%2C900italic|font_style:500%20bold%20regular%3A500%3Anormal&#8221;][vc_column_text] Get started quickly with and overview of the components involved in a typical solutions and practical examples on how to connect a device and how to integrate an external system to the SDS Platform.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/pages\/234"}],"collection":[{"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":25,"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/pages\/234\/revisions"}],"predecessor-version":[{"id":1184,"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/pages\/234\/revisions\/1184"}],"wp:attachment":[{"href":"https:\/\/www.smartdatasystem.es\/it\/wp-json\/wp\/v2\/media?parent=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}