3.2 Constructing data requests
Last updated
Was this helpful?
Last updated
Was this helpful?
Using the dataRequests
, you can specify one or more requests to be made to the Zotero API. In most cases, you'll be using the same apikey
- what will be different is the dataURI
argument, and possibly the parameters (params
) you want to use.
dataURI
: scoping your requestThe dataURI tells the API where to look for items ; it's composed of a user-or-group prefix and a suffix.
The user-or-group prefix will be either users/your_user_id
(for a personal library) or groups/the_group_id
(for group libraries).
The suffix is used to specify which items you want within the library. This means both where the items are located, and what kind of items should be retrieved. The lists out the possible combinations - it's a great resource !
In most cases, I'd suggest using one of the following :
All items from your user library : users/your_user_id/items
All items from one of your collections : users/your_user_id/collections/collection_id/items
params
: filtering your itemsThe params can apply search parameters & filters to your request. Refer to the for an overview of all that they can do ; within the context of the extension, you likely won't need to specify anything here.
If you don't want to apply any parameters, I highly recommend setting params to a value of limit=100
. It's the maximal number of items that can be returned in a single API call ; this will minimize the total number of calls the extension needs to make to get all the items that match a request.
With that said, there are some cases where you might want to use filters, if you have a particular system in Zotero for example. Here are two parameters which you might find helpful :
itemType
will let you scope your request to items of a given type (e.g, papers)
tag
will let you scope your request to items that have/don't have a tag (e.g, papers marked as #read). Logic operators are also available (and, or). Read more .
Requesting all items in your personal library that are tagged as #read
Requesting all book items from one of your collections