We have been manually entering the flow in the last example; in particular, the flows were inserted upon the completion of switch feature negotiation. It would be great if we could dynamically insert and remove flows. Luckily, Ryu already ships with many reference applications with the REST API under the ryu/app directory, such as rest_router.py. The REST API portion of the code is also separated into its own example filename, ofctl_rest.py:
ubuntu@sdnhubvm:~/ryu_latest[15:40] (master)$ ls ryu/app/rest*
ryu/app/rest_conf_switch.py ryu/app/rest_qos.py ryu/app/rest_topology.py
ryu/app/rest_firewall.py ryu/app/rest_router.py ryu/app/rest_vtep.py
...
ubuntu@sdnhubvm:~/ryu_latest[12:34] (master)$ ls ryu/app/ofctl_rest.py
ryu/app/ofctl_rest.py
The rest_router.py application usage is covered in detail in the Ryu book, https://osrg.github.io/ryu-book/en/html/rest_router.html...