It is possible to connect to Requirement Yogi using the Java interface. It requires you to build a Confluence plugin, but don't worry, we have published a sample plugin to make it easy for you.
Search API: We've exposed the Search API so you can read requirements from a plugin.
Document Importer API: We've exposed an API to programatically declare documents with requirements inside. The versioning is either managed by RY or by your plugin.
All of this is explained on the developer portal.