Ben
Ben

Reputation: 53

Limiting query to search API from openlibrary.com

I am learning JS, and I am struggling with this API request. The search API from Openlibrary returns an array of ISBNs, about 400 per book and its slowing down the response time. How can I structure the request so I only get the first result?

This is what I tried:

axios.get(`http://openlibrary.org/search.json?title=${query}
    &limit=100
    &fields=isbn[0]`)

Searching for 0 index isn't working and their schema at https://github.com/internetarchive/openlibrary/blob/master/conf/solr/conf/managed-schema#L136-L216 didn't help too much either.

Upvotes: 2

Views: 807

Answers (1)

Clom
Clom

Reputation: 371

You should use limit and offset params, for example: https://openlibrary.org/search.json?title=the+lord+of+the+rings&limit=2&offset=0

Upvotes: 0

Related Questions