Anthony Anthony - 1 month ago 21
Java Question

Consuming a REST API in DropWizard

I'm building an API in java using DropWizard. However, for certain resources I also need to consume other RESTful API's. These other API's do not require any authentication.

Can DropWizard be used to consume API's? Or what are some other ways to simply consume a RESTful API in a java application? Since I'm using DropWizard I already have Jackson.

So if the REST API is something like this:

[ {"id": "0",
"name" : "Joe"
]


I'd like to have an object like this
List<Foo>

Answer

I suppose you can use a DropWizard's Jersey Client. According to the documentation, it does exactly what you are looking for.

http://www.dropwizard.io/1.0.3/docs/manual/client.html

Comments