Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1. Create a Java Class User that contains the fields id, email, firstName
and lastName.

2. Create a Java Class UserClient that contains a method for querying the first page
of the given REST endpoint. Please make sure that the result is returned as
List<user>. The endpoint https://reqres.in/api/users provides a list of users.

3. Add a main method to UserClient that calls the above method and also prints the
firstName and lastName of each user to the console.

I don't know how to make an API call in Java. I can use any framework such as REST client or JSON Library

What I have tried:

class User{

    private int id;

    private String email;

    private String firstName;

    private String lastName;

    String getFirstName(){
        return firstName;
    }

    String getLastName(){
        return lastName;
    }

    int getID(){
        return id;
    }

    String getEmail(){
        return email;
    }

}
Posted
Updated 11-Aug-22 22:37pm

If you don't know how to do something, Google it: make an API call in Java - Google Search[^]
At least one video, and another 84,000,000 other hits ... Start with them and see what you can learn.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900