Internet Of Things Communications
  • Cover
  • Summary
  • About This Training
    • Objectives
    • Skills
    • Prerequisites
    • Requirements
  • Once Upon A Time ...
  • Introduction
    • Network Topologies
    • Software Defined Radio
    • Wireshark
    • Sub-1GHz Wireless
  • Connectivity
    • Serial
      • Laboratory
        • Linux and Arduino
    • Telephony
    • WiFi
      • WiFi HaLow
      • WiGig
    • Bluetooth
      • Architecture
        • Bluetooth Specifications
        • Bluetooth Low Energy
        • Bluetooth Smart Mesh
      • Protocol Stack
        • Linux
          • HCITool
          • BlueZ
          • L2Ping
          • SDPTool
          • GATTTool
          • BTMon
          • BTProxy
      • Development Boards
        • Intel Edison
        • Arduino
      • Laboratory
        • Serial Port Protocol
        • Linux and Arduino
        • Nordic
        • Virtual Keyboard
        • Reverse Engineering
        • Bluetooth Low Energy
    • Low-Power Wide-Area Networks
      • LoRa
      • SigFox
    • RFID
    • ZigBee
    • Z-Wave
    • Thread
    • HomeKit
    • Satellite
    • Near Field Communication
    • Neul
    • RF
  • Protocols
    • Web
    • Industrial Protocols
    • MQ Telemetry Transport
      • Mosca
      • Brokers
        • Mosquitto
        • VerneMQ
        • HiveMQ
      • Security
      • Applications
      • Laboratory
    • Advanced Message Queuing Protocol
    • Weave
    • Constrained Application Protocol
    • AllJoyn
    • XMPP
    • 6LoWPAN
    • ModBus
    • Others
    • Lightweight M2M
    • Cap'n Proto
    • IPv6
    • RPL
    • Very Simple Control Protocol
    • NATS
  • Libraries
    • ZeroMQ
  • Wrap-Up
    • Online Training
    • Challenge
  • SandBox
Powered by GitBook
On this page
  • Web
  • WebSockets
  • Ajax, Web services, RESTful communication protocols
  • XMPP
  • RESTful API (Representational State Transfer)
  • API Creation
  • Flask
  • Flask-RESTful
  • Project
  1. Protocols

Web

PreviousProtocolsNextIndustrial Protocols

Last updated 7 years ago

Web

WebSockets

Ajax, Web services, RESTful communication protocols

These sit on top of HTTP, thus suffering from the same limitations as HTTP. Many of these protocols also require extensive processing and have a huge code size footprint. Many service providers promote the use of these protocols since their backend infrastructure is based on standard web servers that cannot handle any other type of protocol than HTTP.

  • [Cisco DevNet REST]()

XMPP

RESTful API (Representational State Transfer)

In computing, representational state transfer (REST) is the software architectural style of the World Wide Web. REST's coordinated set of constraints, applied to the design of components in a distributed hypermedia system, can lead to a higher-performing and more maintainable software architecture.

To the extent that systems conform to the constraints of REST they can be called RESTful. RESTful systems typically, but not always, communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, etc.) that web browsers use to retrieve web pages and to send data to remote servers.[4] REST systems interface with external systems as web resources identified by Uniform Resource Identifiers (URIs), for example /people/tom, which can be operated upon using standard verbs such as DELETE /people/tom.

  • [Cisco DevNet REST]()

API Creation

Flask

    root@board:~# pip install Flask
    Downloading/unpacking Flask
      Downloading Flask-0.10.1.tar.gz (544kB): 544kB downloaded
    Installing collected packages: Flask
    Successfully installed Flask
    Cleaning up...
    root@board:~#

Flask-RESTful

    root@board:~# pip install flask-restful
    Downloading/unpacking flask-restful
      Downloading Flask-RESTful-0.3.5.tar.gz (102kB): 102kB downloaded
    Downloading/unpacking aniso8601>=0.82 (from flask-restful)
      Downloading aniso8601-1.1.0.tar.gz (49kB): 49kB downloaded
    Downloading/unpacking python-dateutil (from aniso8601>=0.82->flask-restful)
      Downloading python-dateutil-2.5.1.tar.gz (235kB): 235kB downloaded
    Installing collected packages: flask-restful, aniso8601, python-dateutil
    Successfully installed flask-restful aniso8601 python-dateutil
    Cleaning up...
    root@board:~#

Project

    root@board:~# vi mainflask.py
#!/usr/bin/python
from flask import Flask
from flask_restful import Api, Resource

app = Flask(__name__)
api = Api(app)

class Network(Resource):
    def get(self):
        data = 'Network Data'
        return data

api.add_resource(Network, '/network')

if __name__ == '__main__':
    app.run(debug=True)
    root@board:~# python mainflask.py
     * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
     * Restarting with stat
     * Debugger is active!
     * Debugger pin code: 331-202-890

Connect to your boardipaddress:5000 in a web browser

    127.0.0.1 - - [28/Dec/2015 15:07:38] "GET /network HTTP/1.1" 200 -
    127.0.0.1 - - [28/Dec/2015 15:07:40] "GET /network HTTP/1.1" 200 -

Creating and exposing APIs allows your web application to interact with other applications through machine-to-machine communication. API creation frameworks...

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.

It’s time to write your first REST API. This guide assumes you have a working understanding of Flask, and that you have already installed both Flask and Flask-RESTful.

Flask-RESTful is an extension for Flask that adds support for quickly building REST APIs. It is a lightweight abstraction that works with your existing ORM/libraries. Flask-RESTful encourages best practices with minimal setup. If you are familiar with Flask, Flask-RESTful should be easy to pick up.

https://developer.cisco.com/site/devnet/learn/coding-101-tutorial/#rest-in-action:-now-let's-try-it!
Wikipedia
Wikipedia
Learn REST: A Tutorial
https://developer.cisco.com/site/devnet/learn/coding-101-tutorial/#rest-in-action:-now-let's-try-it!
FullStackPython
Flask Homepage
Here
Browsable Web APIs for Flask
Flask-RESTful Documentation