(PureBasic) 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
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttp::ckSetRequestHeader(http,"Authorization","YOUR_REST_KEY")
jsonStr.s = CkHttp::ckQuickGetStr(http,"https://api2.isbndb.com/book/9780134093413")
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
Debug "Response status code: " + Str(CkHttp::ckLastStatus(http))
Debug "Response JSON:"
Debug jsonStr
CkHttp::ckDispose(http)
ProcedureReturn
EndProcedure
|