Debian Codegraph @

README

raw
1 NAME
2
3 WWW::Zotero - Perl interface to the Zotero API
4
5 SYNOPSIS
6
7 use WWW::Zotero;
8
9 my $client = WWW::Zotero->new;
10 my $client = WWW::Zotero->new(key => 'API-KEY');
11
12 my $data = $client->itemTypes();
13
14 for my $item (@$data) {
15 print "%s\n" , $item->itemType;
16 }
17
18 my $data = $client->itemFields();
19 my $data = $client->itemTypeFields('book');
20 my $data = $client->itemTypeCreatorTypes('book');
21 my $data = $client->creatorFields();
22 my $data = $client->itemTemplate('book');
23 my $key = $client->keyPermissions();
24 my $groups = $client->userGroups($userID);
25
26 my $data = $client->listItems(user => '475425', limit => 5);
27 my $data = $client->listItems(user => '475425', format => 'atom');
28 my $generator = $client->listItems(user => '475425', generator => 1);
29
30 while (my $item = $generator->()) {
31 print "%s\n" , $item->{title};
32 }
33
34 my $data = $client->listItemsTop(user => '475425', limit => 5);
35 my $data = $client->listItemsTrash(user => '475425');
36 my $data = $client->getItem(user => '475425', itemKey => 'TTJFTW87');
37 my $data = $client->getItemTags(user => '475425', itemKey => 'X42A7DEE');
38 my $data = $client->listTags(user => '475425');
39 my $data = $client->listTags(user => '475425', tag => 'Biography');
40 my $data = $client->listCollections(user => '475425');
41 my $data = $client->listCollectionsTop(user => '475425');
42 my $data = $client->getCollection(user => '475425', collectionKey => 'A5G9W6AX');
43 my $data = $client->listSubCollections(user => '475425', collectionKey => 'QM6T3KHX');
44 my $data = $client->listCollectionItems(user => '475425', collectionKey => 'QM6T3KHX');
45 my $data = $client->listCollectionItemsTop(user => '475425', collectionKey => 'QM6T3KHX');
46 my $data = $client->listCollectionItemsTags(user => '475425', collectionKey => 'QM6T3KHX');
47 my $data = $client->listSearches(user => '475425');
48
49 CONFIGURATION
50
51 baseurl
52
53 The base URL for all API requests. Default 'https://api.zotero.org'.
54
55 version
56
57 The API version. Default '3'.
58
59 key
60
61 The API key which can be requested via https://api.zotero.org.
62
63 modified_since
64
65 Include a UNIX time to be used in a If-Modified-Since header to allow
66 for caching of results by your application.
67
68 METHODS
69
70 username2userID
71
72 Find the userID based on a username
73
74 itemTypes()
75
76 Get all item types. Returns a Perl array.
77
78 itemTypes()
79
80 Get all item fields. Returns a Perl array.
81
82 itemTypes($type)
83
84 Get all valid fields for an item type. Returns a Perl array.
85
86 itemTypeCreatorTypes($type)
87
88 Get valid creator types for an item type. Returns a Perl array.
89
90 creatorFields()
91
92 Get localized creator fields. Returns a Perl array.
93
94 itemTemplate($type)
95
96 Get a template for a new item. Returns a Perl hash.
97
98 keyPermissions($key)
99
100 Return the userID and premissions for the given API key.
101
102 userGroups($userID)
103
104 Return an array of the set of groups the current API key as access to.
105
106 listItems(user => $userID, %options)
107
108 listItems(group => $groupID, %options)
109
110 List all items for a user or ar group. Optionally provide a list of
111 options:
112
113 sort - dateAdded, dateModified, title, creator, type, date, publisher,
114 publicationTitle, journalAbbreviation, language, accessDate,
115 libraryCatalog, callNumber, rights, addedBy, numItems (default dateModified)
116 direction - asc, desc
117 limit - integer 1-100* (default 25)
118 start - integer
119 format - perl, atom, bib, json, keys, versions , bibtex , bookmarks,
120 coins, csljson, mods, refer, rdf_bibliontology , rdf_dc ,
121 rdf_zotero, ris , tei , wikipedia (default perl)
122
123 when format => 'json'
124
125 include - bib, data
126
127 when format => 'atom'
128
129 content - bib, html, json
130
131 when format => 'bib' or content => 'bib'
132
133 style - chicago-note-bibliography, apa, ... (see: https://www.zotero.org/styles/)
134
135
136 itemKey - A comma-separated list of item keys. Valid only for item requests. Up to
137 50 items can be specified in a single request.
138 itemType - Item type search
139 q - quick search
140 qmode - titleCreatorYear, everything
141 since - integer
142 tag - Tag search
143
144 See:
145 https://www.zotero.org/support/dev/web_api/v3/basics#user_and_group_library_urls
146 for the search syntax.
147
148 Returns a Perl HASH containing the total number of hits plus the
149 results:
150
151 {
152 total => '132',
153 results => <data>
154 }
155
156 listItems(user => $userID | group => $groupID, generator => 1 , %options)
157
158 Same as listItems but this return a generator for every record found.
159 Use this method to sequentially read the complete resultset. E.g.
160
161 my $generator = $self->listItems(user => '231231', generator);
162
163 while (my $record = $generator->()) {
164 printf "%s\n" , $record->{title};
165 }
166
167 The format is implicit 'perl' in this case.
168
169 listItemsTop(user => $userID | group => $groupID, %options)
170
171 The set of all top-level items in the library, excluding trashed items.
172
173 See 'listItems(...)' functions above for all the execution options.
174
175 listItemsTrash(user => $userID | group => $groupID, %options)
176
177 The set of items in the trash.
178
179 See 'listItems(...)' functions above for all the execution options.
180
181 getItem(itemKey => ... , user => $userID | group => $groupID, %options)
182
183 A specific item in the library.
184
185 See 'listItems(...)' functions above for all the execution options.
186
187 Returns the item if found.
188
189 getItemChildren(itemKey => ... , user => $userID | group => $groupID,
190 %options)
191
192 The set of all child items under a specific item.
193
194 See 'listItems(...)' functions above for all the execution options.
195
196 Returns the children if found.
197
198 getItemTags(itemKey => ... , user => $userID | group => $groupID,
199 %options)
200
201 The set of all tags associated with a specific item.
202
203 See 'listItems(...)' functions above for all the execution options.
204
205 Returns the tags if found.
206
207 listTags(user => $userID | group => $groupID, [tag => $name] , %options)
208
209 The set of tags (i.e., of all types) matching a specific name.
210
211 See 'listItems(...)' functions above for all the execution options.
212
213 Returns the list of tags.
214
215 listCollections(user => $userID | group => $groupID , %options)
216
217 The set of all collections in the library.
218
219 See 'listItems(...)' functions above for all the execution options.
220
221 Returns the list of collections.
222
223 listCollectionsTop(user => $userID | group => $groupID , %options)
224
225 The set of all top-level collections in the library.
226
227 See 'listItems(...)' functions above for all the execution options.
228
229 Returns the list of collections.
230
231 getCollection(collectionKey => ... , user => $userID | group => $groupID,
232 %options)
233
234 A specific item in the library.
235
236 See 'listItems(...)' functions above for all the execution options.
237
238 Returns the collection if found.
239
240 listSubCollections(collectionKey => ...., user => $userID | group =>
241 $groupID , %options)
242
243 The set of subcollections within a specific collection in the library.
244
245 See 'listItems(...)' functions above for all the execution options.
246
247 Returns the list of (sub)collections.
248
249 listCollectionItems(collectionKey => ...., user => $userID | group =>
250 $groupID , %options)
251
252 The set of all items within a specific collection in the library.
253
254 See 'listItems(...)' functions above for all the execution options.
255
256 Returns the list of items.
257
258 listCollectionItemsTop(collectionKey => ...., user => $userID | group =>
259 $groupID , %options)
260
261 The set of top-level items within a specific collection in the library.
262
263 See 'listItems(...)' functions above for all the execution options.
264
265 Returns the list of items.
266
267 listCollectionItemsTags(collectionKey => ...., user => $userID | group =>
268 $groupID , %options)
269
270 The set of tags within a specific collection in the library.
271
272 See 'listItems(...)' functions above for all the execution options.
273
274 Returns the list of items.
275
276 listSearches(user => $userID | group => $groupID , %options)
277
278 The set of all saved searches in the library.
279
280 See 'listItems(...)' functions above for all the execution options.
281
282 Returns the list of saved searches.
283
284 getSearch(searchKey => ... , user => $userID | group => $groupID,
285 %options)
286
287 A specific saved search in the library.
288
289 See 'listItems(...)' functions above for all the execution options.
290
291 Returns the saved search if found.
292
293 AUTHOR
294
295 Patrick Hochstenbach, <patrick.hochstenbach at ugent.be>
296
297 CONTRIBUTORS
298
299 François Rappaz
300
301 LICENSE AND COPYRIGHT
302
303 Copyright 2015 Patrick Hochstenbach
304
305 This program is free software; you can redistribute it and/or modify it
306 under the terms of either: the GNU General Public License as published
307 by the Free Software Foundation; or the Artistic License.
308
309 See http://dev.perl.org/licenses/ for more information.
310