Geek406
Geek406

Reputation: 31

Restrict words in Google Books API

Is there a way to restrict certain words from appearing in a title in google books api. For example, I want to receive data about fantasy books however I keep getting books such as "Guide to Literary Agents 2017" in my search. I was wondering if I could restrict the some words such as "Literary" in my search (or would there be a better way to resolve this problem).

Also this is my api link: https://www.googleapis.com/books/v1/volumes?q=subject: fantasy+ young adult &printType=books&langRestrict= en&maxResults=40&key=APIKey'

Upvotes: 0

Views: 374

Answers (1)

Bill the Lizard
Bill the Lizard

Reputation: 405765

Yes, in the Books APIs Developers Guide, I found this.

To exclude entries that match a given term, use the form q=-term.

So, in your example you could try something like

https://www.googleapis.com/books/v1/volumes?q=-Literary&subject:fantasy+young%20adult&printType=books&langRestrict=en&maxResults=40

I didn't see the title Guide to Literary Agents 2017 in the results, so I tried excluding a few other keywords and it does seem to exclude those titles.

Upvotes: 0

Related Questions