By Dr. Louay Chebib
Very flexible and uses an existing protocol like HTLM
REST not constrained to XML, can return XML, JSON, YAML (YAML Ain't Markup Language) or anything else.
What is ReST?
Representational State Transfer (ReST)
Constraints
Use urllib to get web page data
Simple BOTs
Demo: urllib_HTML.py
Use paramiko to send commands & get data over SSH (UNIX)
Automating SSH
Demo: SSH_paramiko_Demo.py
Simple Flask Server
Demo: Hello World
Server: hello_flask.py
Client: in browser http://127.0.0.1:5000/
or run: urllib_hello.py
ReST API Flask Server & Client
Demo: "CRUD" like
Run on two Sessions/Devices
Server: rest_server_demo.py
(Flask loves Decorators)
Client: REST_client_demo.py
Can also be run with: curl
ReST is not CRUD!
Other Items
Document API interface: preferably at server. e.g. swagger
HTTP methods: (POST GET PATCH DELETE) in ReST relate to CRUD
Compare ReST to SOLID
Store values/data to: database, files...
User validation should be hashed/encrypted
Expose Flask Server: nginx.org