Below we have several examples that demonstrate how to use the FRED Client. Note that the developer can request data from the FRED web service and then save the result to a database — refer to example 4 below to see how this works.

Introduction [ Examples ] Source Code | Maven | Java Documentation (core only) | Caching | Try it | Property Change Notifications

Try it & Examples

Get acclimated with the FRED Client API using the new demonstration application.

Example One

The following example executes a series search — note that all requests to the FRED web services follow the same pattern.

The QueryBuilder takes an instance of the Spring Framework’s RestTemplate and the URL to the FRED endpoint and returns an instance of the class that pertains to that web service.

The QueryBuilder allows the developer to take advantage of method chaining so as to create a single query that includes all of the request parameters; the developer then executes the query by invoking the execute method.

QueryBuilder builder = new QueryBuilder(

Seriess seriess = builder
    .series ()
    .search ()
    .setSearchText("money stock")

Example Two

The integration tests provide a comprehensive set of examples to assist the developer — see the FRED Client QueryBuilder Integration Tests.

Example Three

Bitbucket hosts the FRED Client Advanced Example.

Example Four

The FRED Client domain classes have been annotated with Java Persistence API (JPA) annotations so that the developer can make a call to the FRED service and save the result to a database.

The example above can be saved to the database as follows:


Refer to the FRED Client database integration source code to review an example data access object test.

Leave a Reply

Close Menu
Close Panel