(Java) ISBNdb API v2 Get Book Details
Demonstrates how to send a GET request to the ISBNdb API v2 with Authorization header. For more information, see https://isbndb.com/apidocs/v2#examples
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
http.SetRequestHeader("Authorization","YOUR_REST_KEY");
String jsonStr = http.quickGetStr("https://api2.isbndb.com/book/9780134093413");
if (http.get_LastMethodSuccess() == false) {
System.out.println(http.lastErrorText());
return;
}
System.out.println("Response status code: " + http.get_LastStatus());
System.out.println("Response JSON:");
System.out.println(jsonStr);
}
}
|