OpenAI provides us the ability to invoke its features via RESTful APIs. This blog shows how to invoke the API using Spring Boot. There is nothing special here and no OpenAI Java libraries that I use. One can do the same in standard Java (non-spring) or even in more concise code with Nodejs. But here goes a sample with Spring Boot.
In the tech world one cannot stay a day away from hearing the words API or Microservices. For those who work in startups or tech firms (google type) these are well understood. But once you walk into large non-tech firms, these words are not as well understood.
Once you spend a lot of time with a set of tools there is a tendency to come up with solutions to every problem with just those tools. This narrow tunnel vision is dangerous for a techie since you can be completely blindsided when something new comes up and you are found lacking in new skills. It also inhibits the ability to learn new things and take in new ideas. Having spent a lot of time in the Java Spring tunnel, it was a welcome break for me to try out SparkJava & JDBI recently – void of any Spring, JEE or IoC.
Quick review of setting up a HTTP proxy server to front two separate projects. One containing just the UI code (html, js, css, etc.) and the other a Java Tomcat (Spring) based RESTful API backend.
While SpringMVC makes it quite easy to create RESTful services, this starter project adds a few things more. It provides a consistent way to send error messages in json back to the caller and also integrates Spring Security into the mix.
Finally got around to deploying one of my old restful applications to the open source PaaS Cloudfoundry.com. I have updated the original post with new instructions at Secure RESTful Services with Maven, Spring, Apache CXF and Spring Security.
Just got around to updating an old blog on REST using Jersey. Previously I had a terrible Eclipse dynamic project. Moved it all to Maven and the latest Jersey + Spring implementations. Click here to read the updated blog.