Java
Chilkat2 Java
ISBNdb API v2 Get Book Details
See more HTTP Misc Examples
Demonstrates how to send a GET request to the ISBNdb API v2 with Authorization header.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
http.setRequestHeader("Authorization", "YOUR_REST_KEY");
String jsonStr;
try {
jsonStr = http.quickGetStr("https://api2.isbndb.com/book/9780134093413");
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println("Response status code: " + http.getLastStatus());
System.out.println("Response JSON:");
System.out.println(jsonStr);
}
}