Last active
January 2, 2017 12:08
-
-
Save digitalbuddha/eb6195e6486f90904992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create a Model that represents your JSON data (It’s ok if fields are missing that are present in JSON) | |
public class User { | |
public String avatar_url; | |
public String login; | |
} | |
//Create an interface | |
public interface Github { | |
@GET(“/search/users”) UserResponse users(@Query(“q”) String name); | |
} | |
//Auto Generate implementation from Interface | |
Github api = new RestAdapter.Builder() | |
.setEndpoint(“https://api.github.com") | |
.build() | |
.create(Github.class) | |
// user your endpoint | |
UserResponse response =api.users(request.getName()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment