1.. zephyr:code-sample:: tagoio-http-post
2   :name: TagoIO HTTP Post
3   :relevant-api: bsd_sockets http_client dns_resolve tls_credentials
4
5   Send random temperature values to TagoIO IoT Cloud Platform using HTTP.
6
7Overview
8********
9
10This sample application implements an HTTP client that will do an HTTP post
11request to `TagoIO`_ IoT Service Platform. The sample sends random temperature
12values to simulate a real device. This can be used to speed-up development
13and shows how to send simple JSON data to `TagoIO`_ servers.
14
15The source code for this sample application can be found at:
16:zephyr_file:`samples/net/cloud/tagoio_http_post`.
17
18Requirements
19************
20
21- A free `TagoIO`_ account
22- A board with internet connectivity, see :ref:`networking`
23- The example provides three ways to get internet:
24
25  * Ethernet: Using default configuration
26  * WiFi: Using default configuration plus wifi overlay
27
28TagoIO Device Configuration
29***************************
30
31If you don't have a `TagoIO`_ account, simple create a free account at
32`TagoIO`_.  After that, add a device selecting Custom HTTP(S) protocol.  That
33is it! Now reveal your device token.  The token will be used to identify your
34device when sending data.  You need fill ``CONFIG_TAGOIO_DEVICE_TOKEN`` at
35:zephyr_file:`samples/net/cloud/tagoio_http_post/prj.conf` file with that
36information.
37
38
39Building and Running
40********************
41
42Ethernet
43========
44
45You can use this application on a supported board with ethernet port.  There
46are many like :zephyr:board:`sam4e_xpro`, :zephyr:board:`sam_v71_xult`,
47:zephyr:board:`frdm_k64f`, :zephyr:board:`nucleo_f767zi` etc.  Pick one and just build
48tagoio-http-client sample application with minimal configuration:
49
50.. zephyr-app-commands::
51   :zephyr-app: samples/net/cloud/tagoio_http_post
52   :board: [sam4e_xpro | sam_v71_xult/samv71q21 | frdm_k64f | nucleo_f767zi]
53   :goals: build flash
54   :compact:
55
56
57WIFI
58====
59
60To enable WIFI support, you need a board with an embedded WIFI support like
61:zephyr:board:`disco_l475_iot1` or you can add a shield like
62:ref:`module_esp_8266` or :ref:`inventek_eswifi_shield`.  Additionally you
63need fill ``CONFIG_TAGOIO_HTTP_WIFI_SSID`` with your wifi network SSID and
64``CONFIG_TAGOIO_HTTP_WIFI_PSK`` with the correspondent password at
65:zephyr_file:`samples/net/cloud/tagoio_http_post/overlay-wifi.conf` file.
66
67.. zephyr-app-commands::
68   :zephyr-app: samples/net/cloud/tagoio_http_post
69   :board: disco_l475_iot1
70   :gen-args: -DEXTRA_CONF_FILE=overlay-wifi.conf
71   :goals: build flash
72   :compact:
73
74.. zephyr-app-commands::
75   :zephyr-app: samples/net/cloud/tagoio_http_post
76   :board: [sam_v71_xult/samv71q21 | frdm_k64f | nucleo_f767zi]
77   :shield: [esp_8266_arduino | inventek_eswifi_arduino_uart]
78   :gen-args: -DEXTRA_CONF_FILE=overlay-wifi.conf
79   :goals: build flash
80   :compact:
81
82Visualizing TagoIO dashboard
83****************************
84
85After you got some logs on console it is time to create a dashboard on the
86TagoIO to visualize the data.
87
88* Go to the TagoIO web console
89* Create a dashboard as Normal, give it a denomination and move next
90* Add a line plot graph. You will see your device, temperature variable will
91  be automatically selected for you.
92* Just Save and enjoy!
93
94.. image:: img/TagoIO-pc.jpeg
95     :width: 640px
96     :align: center
97     :alt: TagoIO web dashboard
98
99You can experiment the TagoIO mobile application on your cellphone or tablet.
100Simple go to your app store and search by TagoIO, install, sign in, enjoy!
101
102.. image:: img/TagoIO-mobile.jpeg
103     :width: 480px
104     :align: center
105     :alt: TagoIO mobile dashboard
106
107More information at `TagoIO`_ and `TagoIO Documentation`_.
108
109References
110**********
111
112.. target-notes::
113
114.. _TagoIO:
115   https://tago.io/
116
117.. _TagoIO Documentation:
118   https://docs.tago.io
119