Search code examples
c++jsonapiqtgoogle-books

Accessing Googles Book API via C++ and Qt


I like to get Information from the Google Books API.

Therefore I need to perform a http request like this:

https://www.googleapis.com/books/v1/volumes?q=isbn:3826615956 and retrieve an JSON formated document.

Then it's necessary to extract just some variables from the document. So My Questions are:

  1. Is there any Class in Qt to Access JSON docs and/or to perform the http requests.
  2. If not, how can I manage that with pure c++? Is there any similair example available?

Solution

  • Both parts are supported by Qt, or rather by Qt + third-party library:

    For HTTP requests, use QNetworkAccessManager. The documentation gives some simple examples how to fire a request.

    For Json with Qt4, you can use QJson, available under LGPL. (There will be Json support as part of Qt 5, see here, but that's not there yet in Qt4)