Search code examples
javarestswingwebapi

Is it possible to use a REST or web API in a Java Swing application


I have a Swing application that is done except for the web API part. They have a REST API, but when I was looking at example of using a REST API in Java, they all use a Java web application, and I can't find any for a desktop swing application. So is it still possible to do so?


Solution

  • Yes. It is possible.

    You can Consume (access and read) a REST web service in Swing desktop application.

    You can achieve it using HTTPClient.

    An example - http://www.mkyong.com/webservices/jax-rs/restful-java-client-with-apache-httpclient/