alma 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ module Alma
2
+ class RequestSet < ResultSet
3
+
4
+
5
+ def top_level_key
6
+ 'user_requests'
7
+ end
8
+
9
+ def response_records_key
10
+ 'user_request'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,41 @@
1
+ module Alma
2
+ class ResultSet
3
+
4
+ def initialize(ws_response)
5
+ @ws_response = ws_response
6
+ end
7
+
8
+
9
+ def total_record_count
10
+ @ws_response[top_level_key].fetch('total_record_count', 0).to_i
11
+ end
12
+
13
+ def list
14
+ @list ||= list_results
15
+ end
16
+
17
+ private
18
+ def top_level_key
19
+ raise NotImplementedError 'Subclasses of ResultSet Need to define the top level key'
20
+ end
21
+
22
+ def response_records_key
23
+ raise NotImplementedError 'Subclasses of ResultSet Need to define the key for response records'
24
+ end
25
+
26
+
27
+ def response_records
28
+ @ws_response[top_level_key].fetch(response_records_key,[])
29
+ end
30
+
31
+ def list_results
32
+ #If there is only one record in the response, HTTParty returns as a hash, not
33
+ # an array of hashes, so wrap in array to normalize.
34
+ response_array = (total_record_count == 1) ? [response_records] : response_records
35
+
36
+ response_array.map do |record|
37
+ Alma::AlmaRecord.new(record)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,86 @@
1
+
2
+
3
+ module Alma
4
+ class User < AlmaRecord
5
+ extend Alma::Api
6
+
7
+ attr_accessor :id
8
+
9
+ def post_initialize
10
+ @id = response['primary_id']
11
+ end
12
+
13
+ def fines
14
+ Alma::User.get_fines({:user_id => self.id.to_s})
15
+ end
16
+
17
+ def loans
18
+ Alma::User.get_loans({:user_id => self.id.to_s})
19
+ end
20
+
21
+ def requests
22
+ Alma::User.get_requests({:user_id => self.id.to_s})
23
+ end
24
+
25
+ class << self
26
+ # Static methods that do the actual querying
27
+
28
+ def find(args = {})
29
+ #TODO Handle Search Queries
30
+ #TODO Handle Pagination
31
+ #TODO Handle looping through all results
32
+
33
+ return find_by_id(:user_id => args[:user_id]) if args.fetch(:user_id, nil)
34
+ params = query_merge args
35
+ response = resources.almaws_v1_users.get(params)
36
+ Alma::UserSet.new(response)
37
+ end
38
+
39
+ def find_by_id(user_id_hash)
40
+ params = query_merge user_id_hash
41
+ response = resources.almaws_v1_users.user_id.get(params)
42
+ User.new(response['user'])
43
+ end
44
+
45
+ def get_fines(args)
46
+ #TODO Handle Additional Parameters
47
+ #TODO Handle Pagination
48
+ #TODO Handle looping through all results
49
+ params = query_merge args
50
+ response = resources.almaws_v1_users.user_id_fees.get(params)
51
+ Alma::FineSet.new(response)
52
+ end
53
+
54
+ def get_loans(args)
55
+ #TODO Handle Additional Parameters
56
+ #TODO Handle Pagination
57
+ #TODO Handle looping through all results
58
+ params = query_merge args
59
+ response = resources.almaws_v1_users.user_id_loans.get(params)
60
+ Alma::LoanSet.new(response)
61
+ end
62
+
63
+ def get_requests(args)
64
+ #TODO Handle Additional Parameters
65
+ #TODO Handle Pagination
66
+ #TODO Handle looping through all results
67
+ params = query_merge args
68
+ response = resources.almaws_v1_users.user_id_requests.get(params)
69
+ Alma::RequestSet.new(response)
70
+ end
71
+
72
+ def authenticate(args)
73
+ # Authenticates a Alma user with their Alma Password
74
+ args.merge!({op: 'auth'})
75
+ params = query_merge args
76
+ response = resources.almaws_v1_users.user_id.post(params)
77
+ response.code == 204
78
+ end
79
+
80
+
81
+ def set_wadl_filename
82
+ 'user.wadl'
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,29 @@
1
+ module Alma
2
+ class UserSet
3
+
4
+ attr_reader :total_record_count, :list
5
+
6
+ def initialize(ws_response)
7
+ @ws_response = ws_response
8
+ end
9
+
10
+ def total_record_count
11
+ @ws_response['users'].fetch('total_record_count', 0)
12
+ end
13
+
14
+ def list
15
+ @list ||= list_results
16
+ end
17
+
18
+ private
19
+ def response_records
20
+ @ws_response['users'].fetch('user',[])
21
+ end
22
+
23
+ def list_results
24
+ response_records.map do |fee|
25
+ Alma::AlmaRecord.new(fee)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module Alma
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,795 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
+ <doc title="Alma"/>
4
+ <grammars/>
5
+ <resources base="https://api-na.hosted.exlibrisgroup.com">
6
+ <resource path="/almaws/v1/users">
7
+ <method name="GET">
8
+ <doc title="Retrieve users">This API returns a list of Users, sorted by last name.</doc>
9
+ <request>
10
+ <param name="limit" style="query" default="10" type="xs:int">
11
+ <doc>Limits the number of results. Optional. Valid values are 0-100. Default value: 10.</doc>
12
+ </param>
13
+ <param name="offset" style="query" default="0" type="xs:int">
14
+ <doc>Offset of the results returned. Optional. Default value: 0, which means that the first results will be returned.</doc>
15
+ </param>
16
+ <param name="q" style="query" default="" type="xs:string">
17
+ <doc>Search query. Optional. Searching for words from: primary_id, first_name, last_name, middle_name, email, job_category, identifiers, general_info and ALL. Example (note the tilde between the code and text): q=last_name~Smith (see [Brief Search|https://developers.exlibrisgroup.com/blog/How-we-re-building-APIs-at-Ex-Libris#BriefSearch])</doc>
18
+ </param>
19
+ <param name="order_by" style="query" default="last_name, first_name, primary_id" type="xs:string">
20
+ <doc>A few sort options are available: last_name, first_name and primary_id. One sort option may be used at a time. A secondary sort key, primary_id, is added if last_name or first_name is the primary sort. Default sorting is by all three in the following order: last_name, first_name, primary_id. If the query option is used, the result will not sort by primary_id.</doc>
21
+ </param>
22
+ </request>
23
+ <response>
24
+ <doc title="402119">General error.</doc>
25
+ <doc title="401651">Identifier not found.</doc>
26
+ <representation mediaType="application/xml">
27
+ <doc title="Users">rest_users.xsd</doc>
28
+ </representation>
29
+ <representation mediaType="application/json">
30
+ <doc title="Users">rest_users.xsd</doc>
31
+ </representation>
32
+ </response>
33
+ </method>
34
+ <method name="POST">
35
+ <doc title="Create user">This Web service creates a new user.</doc>
36
+ <request>
37
+ <param name="social_authentication" style="query" default="false" type="xs:string">
38
+ <doc>When customer parameter social_authentication='True': Send social authentication email to patron. Default value: False.</doc>
39
+ </param>
40
+ <param name="send_pin_number_letter" style="query" default="false" type="xs:string">
41
+ <doc>The email notification for PIN setting change will be sent</doc>
42
+ </param>
43
+ <representation mediaType="application/xml">
44
+ <doc>This method takes a User object.</doc>
45
+ </representation>
46
+ <representation mediaType="application/json">
47
+ <doc>This method takes a User object.</doc>
48
+ </representation>
49
+ </request>
50
+ <response>
51
+ <doc title="401676">No valid XML was given.</doc>
52
+ <doc title="401851">User with identifier of type Y already exists.</doc>
53
+ <doc title="401664">Mandatory field is missing: X</doc>
54
+ <doc title="401852">Given user group is not legal.</doc>
55
+ <doc title="401853">External Id must be empty for internal user.</doc>
56
+ <doc title="401854">External Id must be given for external user.</doc>
57
+ <doc title="401855">The account type 'Internal with external authentication' is currently not supported.</doc>
58
+ <doc title="401857">The given user account type is illegal (must be INTERNAL/EXTERNAL).</doc>
59
+ <doc title="401658">General Error - Failed to create new user</doc>
60
+ <doc title="401863">Given X type (Y) is not supported for given user record type (Z).</doc>
61
+ <doc title="401864">Given X type (Y) is invalid.</doc>
62
+ <representation mediaType="application/xml">
63
+ <doc title="User">rest_user.xsd</doc>
64
+ </representation>
65
+ <representation mediaType="application/json">
66
+ <doc title="User">rest_user.xsd</doc>
67
+ </representation>
68
+ </response>
69
+ </method>
70
+ <resource path="operation/test">
71
+ <method name="GET">
72
+ <doc title="GET User Test API">This API is used to test if the API key was configured correctly.</doc>
73
+ <response>
74
+ <representation mediaType="application/xml">
75
+ <param name="result" style="plain" type="xs:string"/>
76
+ </representation>
77
+ <representation mediaType="application/json">
78
+ <param name="result" style="plain" type="xs:string"/>
79
+ </representation>
80
+ </response>
81
+ </method>
82
+ <method name="POST">
83
+ <doc title="POST User Test API">This API is used to test if the API key was configured correctly, including read/write permissions.</doc>
84
+ <response>
85
+ <representation mediaType="application/xml">
86
+ <param name="result" style="plain" type="xs:string"/>
87
+ </representation>
88
+ <representation mediaType="application/json">
89
+ <param name="result" style="plain" type="xs:string"/>
90
+ </representation>
91
+ </response>
92
+ </method>
93
+ </resource>
94
+ <resource path="{user_id}">
95
+ <param name="user_id" style="template" type="xs:string">
96
+ <doc>A unique identifier for the user</doc>
97
+ </param>
98
+ <method name="DELETE">
99
+ <doc title="Delete user">This Web service deletes a specific user.</doc>
100
+ <request>
101
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
102
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
103
+ </param>
104
+ </request>
105
+ <response>
106
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
107
+ <doc title="401850">Failed to delete user with identifier X of type Y.</doc>
108
+ <representation mediaType="application/xml">
109
+ <param name="result" style="plain" type="xs:string"/>
110
+ </representation>
111
+ <representation mediaType="application/json">
112
+ <param name="result" style="plain" type="xs:string"/>
113
+ </representation>
114
+ </response>
115
+ </method>
116
+ <method name="GET">
117
+ <doc title="Get user details">This Web service returns a specific user's details.</doc>
118
+ <request>
119
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
120
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
121
+ </param>
122
+ <param name="view" style="query" default="full" type="xs:string">
123
+ <doc>Special view of User object. Optional. Possible values: full - full User object will be returned. brief - only user's core information, emails, identifiers and statistics are returned. By default, the full User object will be returned.</doc>
124
+ </param>
125
+ <param name="expand" style="query" default="none" type="xs:string">
126
+ <doc>This parameter allows for expanding on some user information. Three options are available: loans-Include the total number of loans; requests-Include the total number of requests; fees-Include the balance of fees. To have more than one option, use a comma separator.</doc>
127
+ </param>
128
+ </request>
129
+ <response>
130
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
131
+ <doc title="401861">User with identifier X was not found..</doc>
132
+ <doc title="60101">General Error: An error has occurred while processing the request.</doc>
133
+ <representation mediaType="application/xml">
134
+ <doc title="User">rest_user.xsd</doc>
135
+ </representation>
136
+ <representation mediaType="application/json">
137
+ <doc title="User">rest_user.xsd</doc>
138
+ </representation>
139
+ </response>
140
+ </method>
141
+ <method name="POST">
142
+ <doc title="Authenticate user">This Web service runs the process of authenticating a given user in Alma.
143
+ Authentication operation requires a password which may be entered as a parameter or with the header: Exl-User-Pw
144
+ Successful authentication will result with an HTTP 204 (success - no content) response.
145
+ This API is meant for internal users where Alma is the identity provider.</doc>
146
+ <request>
147
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
148
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
149
+ </param>
150
+ <param name="op" style="query" type="xs:string">
151
+ <doc>The operation to be performed on the user. Mandatory. Currently only op=auth is supported</doc>
152
+ </param>
153
+ <param name="password" style="query" type="xs:string">
154
+ <doc>Add the user's password. Or, enter the password in the header Exl-User-Pw. A password is mandatory for op=auth.</doc>
155
+ </param>
156
+ </request>
157
+ <response>
158
+ <doc title="401866">User authentication failed</doc>
159
+ <representation mediaType="application/xml">
160
+ <param name="result" style="plain" type="xs:string"/>
161
+ </representation>
162
+ <representation mediaType="application/json">
163
+ <param name="result" style="plain" type="xs:string"/>
164
+ </representation>
165
+ </response>
166
+ </method>
167
+ <method name="PUT">
168
+ <doc title="Update User Details">This Web service updates a specific user's details.
169
+
170
+ The update is done in a 'Swap All' mode: existing fields' information will be replaced with the incoming information. Incoming lists will replace existing lists.
171
+ Exception for this are the following fields:
172
+ roles - if the incoming list does not contain roles, exsiting roles will be kept.
173
+ User group, Job title, PIN number, User language, Resource sharing libraries, Campus code, User title (for external user): these fields will not be replaced if updated manually (or if empty in the incoming user record), unless 'override' parameter is sent with the field's name.</doc>
174
+ <request>
175
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
176
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
177
+ </param>
178
+ <param name="override" style="query" default="" type="xs:string">
179
+ <doc>The following fields of the user object are not replaced if they were updated manually:
180
+ user_group, job_category, pin_number, preferred_language, campus_code, rs_libraries, user_title, library_notices.
181
+ To update these fields, specify the fields you want to replace in this parameter.
182
+ For example override=user_group,job_category. Default is empty.</doc>
183
+ </param>
184
+ <param name="send_pin_number_letter" style="query" default="false" type="xs:string">
185
+ <doc>The email notification for PIN setting change will be sent</doc>
186
+ </param>
187
+ <representation mediaType="application/xml">
188
+ <doc>This method takes a User object.</doc>
189
+ </representation>
190
+ <representation mediaType="application/json">
191
+ <doc>This method takes a User object.</doc>
192
+ </representation>
193
+ </request>
194
+ <response>
195
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
196
+ <doc title="401859">Action currently not supported.</doc>
197
+ <doc title="401676">No valid XML was given.</doc>
198
+ <doc title="401858">The external id in DB does not fit the given value in xml - external id cannot be updated.</doc>
199
+ <doc title="401855">The account type 'Internal with external authentication' is currently not supported.</doc>
200
+ <doc title="401860">Failed to update user.</doc>
201
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
202
+ <doc title="401863">Given X type (Y) is not supported for given user record type (Z).</doc>
203
+ <doc title="401864">Given X type (Y) is invalid.</doc>
204
+ <representation mediaType="application/xml">
205
+ <doc title="User">rest_user.xsd</doc>
206
+ </representation>
207
+ <representation mediaType="application/json">
208
+ <doc title="User">rest_user.xsd</doc>
209
+ </representation>
210
+ </response>
211
+ </method>
212
+ </resource>
213
+ <resource path="{user_id}/deposits">
214
+ <param name="user_id" style="template" type="xs:string">
215
+ <doc>A unique identifier for the user</doc>
216
+ </param>
217
+ <method name="GET">
218
+ <doc title="deposits by user id">This Web service retrieves the user deposits for a particular user id </doc>
219
+ <request>
220
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
221
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
222
+ </param>
223
+ <param name="status" style="query" default="" type="xs:string">
224
+ <doc>filter deposits by status</doc>
225
+ </param>
226
+ <param name="limit" style="query" default="10" type="xs:int">
227
+ <doc>Limits the number of results. Optional. Valid values are 0-100. Default value: 10.</doc>
228
+ </param>
229
+ <param name="offset" style="query" default="0" type="xs:int">
230
+ <doc>Offset of the results returned. Optional. Default value: 0, which means that the first results will be returned.</doc>
231
+ </param>
232
+ </request>
233
+ <response>
234
+ <doc title="402238">Failed to get deposits.</doc>
235
+ <representation mediaType="application/xml">
236
+ <doc title="User Deposit For User ID and Deposit ID">rest_user_deposits.xsd</doc>
237
+ </representation>
238
+ <representation mediaType="application/json">
239
+ <doc title="User Deposit For User ID and Deposit ID">rest_user_deposits.xsd</doc>
240
+ </representation>
241
+ </response>
242
+ </method>
243
+ <method name="POST">
244
+ <doc title="Create deposit">This API performs creation of a deposit object. Currently supported: submittig deposit, submitting deposit as a draft.</doc>
245
+ <request>
246
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
247
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
248
+ </param>
249
+ <param name="draft" style="query" default="false" type="xs:string">
250
+ <doc>Boolean flag for indicating whether submit as draft.</doc>
251
+ </param>
252
+ <representation mediaType="application/xml">
253
+ <doc>This method takes a Deposit object.</doc>
254
+ </representation>
255
+ <representation mediaType="application/json">
256
+ <doc>This method takes a Deposit object.</doc>
257
+ </representation>
258
+ </request>
259
+ <response>
260
+ <doc title="401652">General Error - An error has occurred while creating the deposit.</doc>
261
+ <doc title="402205">Input parameter X (Y) is not numeric.</doc>
262
+ <doc title="401666">X parameter is not valid.</doc>
263
+ <representation mediaType="application/xml">
264
+ <doc title="Deposit">rest_user_deposit.xsd</doc>
265
+ </representation>
266
+ <representation mediaType="application/json">
267
+ <doc title="Deposit">rest_user_deposit.xsd</doc>
268
+ </representation>
269
+ </response>
270
+ </method>
271
+ </resource>
272
+ <resource path="{user_id}/deposits/{deposit_id}">
273
+ <param name="user_id" style="template" type="xs:string">
274
+ <doc>A unique identifier for the user</doc>
275
+ </param>
276
+ <param name="deposit_id" style="template" type="xs:string">
277
+ <doc>A unique identifier for the deposit</doc>
278
+ </param>
279
+ <method name="GET">
280
+ <doc title="deposit by user id and deposit id">This Web service retrieves the user deposit for a particular user id and deposit id.</doc>
281
+ <request>
282
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
283
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
284
+ </param>
285
+ </request>
286
+ <response>
287
+ <doc title="402238">Failed to get deposit.</doc>
288
+ <representation mediaType="application/xml">
289
+ <doc title="User Deposit For User ID and Deposit ID">rest_user_deposit.xsd</doc>
290
+ </representation>
291
+ <representation mediaType="application/json">
292
+ <doc title="User Deposit For User ID and Deposit ID">rest_user_deposit.xsd</doc>
293
+ </representation>
294
+ </response>
295
+ </method>
296
+ <method name="POST">
297
+ <doc title="Action on a request">This API performs an update of a deposit. Currently supported: withdraw and submit of a returned/draft deposit.</doc>
298
+ <request>
299
+ <param name="op" style="query" default="" type="xs:string">
300
+ <doc>The operation to be performed on the deposit. Mandatory. Currently submit and withdraw are supported.</doc>
301
+ </param>
302
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
303
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
304
+ </param>
305
+ <representation mediaType="application/xml">
306
+ <doc>This method takes a Request object.</doc>
307
+ </representation>
308
+ <representation mediaType="application/json">
309
+ <doc>This method takes a Request object.</doc>
310
+ </representation>
311
+ </request>
312
+ <response>
313
+ <doc title="401652">General Error - An error has occurred while updating the deposit.</doc>
314
+ <doc title="401666">X parameter is not valid.</doc>
315
+ <representation mediaType="application/xml">
316
+ <doc title="Deposit">rest_user_deposit.xsd</doc>
317
+ </representation>
318
+ <representation mediaType="application/json">
319
+ <doc title="Deposit">rest_user_deposit.xsd</doc>
320
+ </representation>
321
+ </response>
322
+ </method>
323
+ </resource>
324
+ <resource path="{user_id}/fees">
325
+ <param name="user_id" style="template" type="xs:string">
326
+ <doc>A unique identifier for the user</doc>
327
+ </param>
328
+ <method name="GET">
329
+ <doc title="Get user fines/fees">This API returns a user's fines and fees.</doc>
330
+ <request>
331
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
332
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
333
+ </param>
334
+ <param name="status" style="query" default="ACTIVE" type="xs:string">
335
+ <doc>Return fees of this status only. Optional. If this is not provided, all active fees will be returned. The values that can be used are {ACTIVE|INDISPUTE}.</doc>
336
+ </param>
337
+ </request>
338
+ <response>
339
+ <doc title="402119">General error.</doc>
340
+ <doc title="401651">Identifier not found.</doc>
341
+ <doc title="401666">Parameter is not valid.</doc>
342
+ <representation mediaType="application/xml">
343
+ <doc title="Fees">rest_fees.xsd</doc>
344
+ </representation>
345
+ <representation mediaType="application/json">
346
+ <doc title="Fees">rest_fees.xsd</doc>
347
+ </representation>
348
+ </response>
349
+ </method>
350
+ </resource>
351
+ <resource path="{user_id}/fees/all">
352
+ <param name="user_id" style="template" type="xs:string">
353
+ <doc>A unique identifier for the user</doc>
354
+ </param>
355
+ <method name="POST">
356
+ <doc title="Pay user fines/fees">This API posts a payment against a specific user's fines and fees as a whole.</doc>
357
+ <request>
358
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
359
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
360
+ </param>
361
+ <param name="op" style="query" type="xs:string">
362
+ <doc>The operation to be performed on the user's specified fee. Mandatory. Currently only op=pay is supported</doc>
363
+ </param>
364
+ <param name="amount" style="query" default="" type="xs:string">
365
+ <doc>The amount of the payment to be made on the user's specified fees. To pay the entire balance use amount=ALL</doc>
366
+ </param>
367
+ <param name="method" style="query" default="" type="xs:string">
368
+ <doc>The Payment method. Relevant and mandatory if op=pay. Options are CREDIT_CARD, ONLINE, or CASH</doc>
369
+ </param>
370
+ <param name="comment" style="query" default="" type="xs:string">
371
+ <doc>A note that can be attached to the payment action. Optional.</doc>
372
+ </param>
373
+ <param name="external_transaction_id" style="query" default="" type="xs:string">
374
+ <doc>An external payment system transaction ID. Optional.</doc>
375
+ </param>
376
+ </request>
377
+ <response>
378
+ <doc title="402119">General error.</doc>
379
+ <doc title="401651">Identifier not found.</doc>
380
+ <doc title="401666">Parameter is not valid.</doc>
381
+ <representation mediaType="application/xml">
382
+ <doc title="Fees">rest_fees.xsd</doc>
383
+ </representation>
384
+ <representation mediaType="application/json">
385
+ <doc title="Fees">rest_fees.xsd</doc>
386
+ </representation>
387
+ </response>
388
+ </method>
389
+ </resource>
390
+ <resource path="{user_id}/fees/{fee_id}">
391
+ <param name="user_id" style="template" type="xs:string">
392
+ <doc>A unique identifier for the user</doc>
393
+ </param>
394
+ <param name="fee_id" style="template" type="xs:string">
395
+ <doc>The fine/fee identifier</doc>
396
+ </param>
397
+ <method name="GET">
398
+ <doc title="Get user fine/fee">This API returns a specific fine or fee for a user.</doc>
399
+ <request>
400
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
401
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
402
+ </param>
403
+ </request>
404
+ <response>
405
+ <doc title="402119">General error.</doc>
406
+ <doc title="401665">Fine not found.</doc>
407
+ <doc title="401651">Identifier not found.</doc>
408
+ <doc title="401666">Parameter is not valid.</doc>
409
+ <representation mediaType="application/xml">
410
+ <doc title="Fee">rest_fee.xsd</doc>
411
+ </representation>
412
+ <representation mediaType="application/json">
413
+ <doc title="Fee">rest_fee.xsd</doc>
414
+ </representation>
415
+ </response>
416
+ </method>
417
+ <method name="POST">
418
+ <doc title="Pay/waive/dispute/restore user fine/fee">This API applies the specified operation to a specific fine/fee.</doc>
419
+ <request>
420
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
421
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
422
+ </param>
423
+ <param name="op" style="query" type="xs:string">
424
+ <doc>The operation to be performed on the user's specified fee. Mandatory. Options are pay, waive, dispute or restore</doc>
425
+ </param>
426
+ <param name="amount" style="query" default="" type="xs:string">
427
+ <doc>The amount of the payment to be made on the user's specified fees. Relevant for op=pay,waive</doc>
428
+ </param>
429
+ <param name="method" style="query" default="" type="xs:string">
430
+ <doc>The Payment method. Relevant and mandatory if op=pay. Options are CREDIT_CARD, ONLINE, or CASH</doc>
431
+ </param>
432
+ <param name="reason" style="query" default="" type="xs:string">
433
+ <doc>The reason for waiving the fine/fee. Mandatory if op=waive. The value should be one of the codes from the Reasons for Transactions code table.</doc>
434
+ </param>
435
+ <param name="comment" style="query" default="" type="xs:string">
436
+ <doc>A note that can be attached to the action. Optional.</doc>
437
+ </param>
438
+ <param name="external_transaction_id" style="query" default="" type="xs:string">
439
+ <doc>An external payment system transaction ID. Relevant for op=pay</doc>
440
+ </param>
441
+ </request>
442
+ <response>
443
+ <doc title="402119">General error.</doc>
444
+ <doc title="401665">Fine not found.</doc>
445
+ <doc title="401651">Identifier not found.</doc>
446
+ <doc title="401666">Parameter is not valid.</doc>
447
+ <representation mediaType="application/xml">
448
+ <doc title="Fee">rest_fee.xsd</doc>
449
+ </representation>
450
+ <representation mediaType="application/json">
451
+ <doc title="Fee">rest_fee.xsd</doc>
452
+ </representation>
453
+ </response>
454
+ </method>
455
+ </resource>
456
+ <resource path="{user_id}/loans">
457
+ <param name="user_id" style="template" type="xs:string">
458
+ <doc>A unique identifier for the user</doc>
459
+ </param>
460
+ <method name="GET">
461
+ <doc title="Retrieve user loans">This Web service retrieves a list of active loans for a user.</doc>
462
+ <request>
463
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
464
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
465
+ </param>
466
+ <param name="limit" style="query" default="10" type="xs:int">
467
+ <doc>Limits the number of results. Optional. Valid values are 0-100. Default value: 10.</doc>
468
+ </param>
469
+ <param name="offset" style="query" default="0" type="xs:int">
470
+ <doc>Offset of the results returned. Optional. Default value: 0, which means that the first results will be returned. </doc>
471
+ </param>
472
+ <param name="order_by" style="query" default="id" type="xs:string">
473
+ <doc>A few sort options are available (only one can be sent): loan_date, due_date, barcode, title and author. A secondary sort key, id, is added to the single sort option chosen. Default sorting is by id.</doc>
474
+ </param>
475
+ <param name="direction" style="query" default="ASC" type="xs:string">
476
+ <doc>Sorting direction: ASC/DESC. Default: ASC.</doc>
477
+ </param>
478
+ <param name="expand" style="query" type="xs:string">
479
+ <doc>Comma separated list of values for expansion of results. Possible values: 'renewable'</doc>
480
+ </param>
481
+ </request>
482
+ <response>
483
+ <doc title="401861">User with identifier X was not found.</doc>
484
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
485
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
486
+ <representation mediaType="application/xml">
487
+ <doc title="User Loans">rest_item_loans.xsd</doc>
488
+ </representation>
489
+ <representation mediaType="application/json">
490
+ <doc title="User Loans">rest_item_loans.xsd</doc>
491
+ </representation>
492
+ </response>
493
+ </method>
494
+ <method name="POST">
495
+ <doc title="Create user loan">This Web service loans an item to a user. The loan will be created according to the library's policy.</doc>
496
+ <request>
497
+ <param name="item_pid" style="query" type="xs:string">
498
+ <doc>The Item ID. This parameter or the item_barcode parameter must be supplied.</doc>
499
+ </param>
500
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
501
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
502
+ </param>
503
+ <param name="item_barcode" style="query" type="xs:string">
504
+ <doc>The Item barcode. This parameter or the item_pid parameter must be supplied.</doc>
505
+ </param>
506
+ <representation mediaType="application/xml">
507
+ <doc>This method takes a Loan object.</doc>
508
+ </representation>
509
+ <representation mediaType="application/json">
510
+ <doc>This method takes a Loan object.</doc>
511
+ </representation>
512
+ </request>
513
+ <response>
514
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
515
+ <doc title="401153">Item cannot be loaned from this circulation desk.</doc>
516
+ <doc title="401651">Item is not loanable.</doc>
517
+ <doc title="401672">PID field is empty.</doc>
518
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
519
+ <representation mediaType="application/xml">
520
+ <doc title="Item Loan">rest_item_loan.xsd</doc>
521
+ </representation>
522
+ <representation mediaType="application/json">
523
+ <doc title="Item Loan">rest_item_loan.xsd</doc>
524
+ </representation>
525
+ </response>
526
+ </method>
527
+ </resource>
528
+ <resource path="{user_id}/loans/{loan_id}">
529
+ <param name="user_id" style="template" type="xs:string">
530
+ <doc>A unique identifier for the user</doc>
531
+ </param>
532
+ <param name="loan_id" style="template" type="xs:string">
533
+ <doc>A unique identifier for the loan</doc>
534
+ </param>
535
+ <method name="GET">
536
+ <doc title="Loan by user id and loan id">This Web service retrieves the user loan for a particular user id and loan id.</doc>
537
+ <request/>
538
+ <response>
539
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
540
+ <representation mediaType="application/xml">
541
+ <doc title="User Loan For User ID and Loan ID">rest_item_loan.xsd</doc>
542
+ </representation>
543
+ <representation mediaType="application/json">
544
+ <doc title="User Loan For User ID and Loan ID">rest_item_loan.xsd</doc>
545
+ </representation>
546
+ </response>
547
+ </method>
548
+ <method name="POST">
549
+ <doc title="Renew loan">This Web service renews a loan.</doc>
550
+ <request>
551
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
552
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
553
+ </param>
554
+ <param name="op" style="query" type="xs:string">
555
+ <doc>Operation. Currently only op=renew is supported</doc>
556
+ </param>
557
+ </request>
558
+ <response>
559
+ <doc title="401823">Loan ID XXX does not exist.</doc>
560
+ <doc title="401822">Cannot renew loan: Loan ID XXX.</doc>
561
+ <representation mediaType="application/xml">
562
+ <doc title="User Loan">rest_item_loan.xsd</doc>
563
+ </representation>
564
+ <representation mediaType="application/json">
565
+ <doc title="User Loan">rest_item_loan.xsd</doc>
566
+ </representation>
567
+ </response>
568
+ </method>
569
+ </resource>
570
+ <resource path="{user_id}/requests">
571
+ <param name="user_id" style="template" type="xs:string">
572
+ <doc>A unique identifier for the user</doc>
573
+ </param>
574
+ <method name="GET">
575
+ <doc title="Retrieve user requests">This Web service returns list of requests for a specific user.</doc>
576
+ <request>
577
+ <param name="request_type" style="query" type="xs:string">
578
+ <doc>Filter results by request type. Optional. Possible values: HOLD, DIGITIZATION, BOOKING. If not supplied, all request types will be returned.</doc>
579
+ </param>
580
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
581
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
582
+ </param>
583
+ <param name="limit" style="query" default="10" type="xs:int">
584
+ <doc>Limits the number of results. Optional. Valid values are 0-100. Default value: 10.</doc>
585
+ </param>
586
+ <param name="offset" style="query" default="0" type="xs:string">
587
+ <doc>Offset of the results returned. Optional.Default value: 0, which means that the first results will be returned. </doc>
588
+ </param>
589
+ <param name="status" style="query" default="active" type="xs:string">
590
+ <doc>Active or History request status. Default is active. The 'history' option is only available if the 'should_anonymize_requests' customer parameter is set to 'false' at the time the request was completed.</doc>
591
+ </param>
592
+ </request>
593
+ <response>
594
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
595
+ <doc title="401652">General Error - An error has occurred while processing the request.</doc>
596
+ <representation mediaType="application/xml">
597
+ <doc title="User Requests">rest_user_requests.xsd</doc>
598
+ </representation>
599
+ <representation mediaType="application/json">
600
+ <doc title="User Requests">rest_user_requests.xsd</doc>
601
+ </representation>
602
+ </response>
603
+ </method>
604
+ <method name="POST">
605
+ <doc title="Create user request">This Web service creates a user's request for a library resource. The request can be for a physical item (request types: hold, booking), or a request for digitizing a file (request type: digitization). The request can be placed on title level or on item level.</doc>
606
+ <request>
607
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
608
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
609
+ </param>
610
+ <param name="mms_id" style="query" type="xs:string">
611
+ <doc>The requested title. This parameter is mandatory if the request is in title level.</doc>
612
+ </param>
613
+ <param name="item_pid" style="query" type="xs:string">
614
+ <doc>The requested item ID. This parameter is mandatory if the request is in item level.</doc>
615
+ </param>
616
+ <representation mediaType="application/xml">
617
+ <doc>This method takes a Request object.</doc>
618
+ </representation>
619
+ <representation mediaType="application/json">
620
+ <doc>This method takes a Request object.</doc>
621
+ </representation>
622
+ </request>
623
+ <response>
624
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
625
+ <doc title="401129">No items can fulfill the submitted request.</doc>
626
+ <doc title="401136">Failed to save the request: Patron has active request for selected item.</doc>
627
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
628
+ <representation mediaType="application/xml">
629
+ <doc title="User Request">rest_user_request.xsd</doc>
630
+ </representation>
631
+ <representation mediaType="application/json">
632
+ <doc title="User Request">rest_user_request.xsd</doc>
633
+ </representation>
634
+ </response>
635
+ </method>
636
+ </resource>
637
+ <resource path="{user_id}/requests/{request_id}">
638
+ <param name="user_id" style="template" type="xs:string">
639
+ <doc>A unique identifier for the user</doc>
640
+ </param>
641
+ <param name="request_id" style="template" type="xs:string">
642
+ <doc>A unique identifier of the request that should be canceled.</doc>
643
+ </param>
644
+ <method name="DELETE">
645
+ <doc title="Cancel user request">This Web service cancels a specific user request.</doc>
646
+ <request>
647
+ <param name="reason" style="query" type="xs:string">
648
+ <doc>Code of the cancel reason. Must be a value from the code table 'RequestCancellationReasons'</doc>
649
+ </param>
650
+ <param name="note" style="query" default="" type="xs:string">
651
+ <doc>Note with additional information regarding the cancellation.</doc>
652
+ </param>
653
+ <param name="notify_user" style="query" default="true" type="xs:boolean">
654
+ <doc>Boolean flag for notifying the requester of the cancellation (when relevant). Defaults to 'true'.</doc>
655
+ </param>
656
+ </request>
657
+ <response status="204">
658
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
659
+ <doc title="401694">Request Identifier not found.</doc>
660
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
661
+ </response>
662
+ </method>
663
+ <method name="GET">
664
+ <doc title="Retrieve user request">This Web service returns a request by a specific request id.</doc>
665
+ <request>
666
+ <param name="user_id_type" style="query" default="all_unique" type="xs:string">
667
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
668
+ </param>
669
+ </request>
670
+ <response>
671
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
672
+ <doc title="401652">General Error - An error has occurred while processing the request.</doc>
673
+ <representation mediaType="application/xml">
674
+ <doc title="User Request">rest_user_request.xsd</doc>
675
+ </representation>
676
+ <representation mediaType="application/json">
677
+ <doc title="User Request">rest_user_request.xsd</doc>
678
+ </representation>
679
+ </response>
680
+ </method>
681
+ <method name="POST">
682
+ <doc title="Action on a request">This API performs an action on a request. Currently supported: moving digitization requests to their next step.</doc>
683
+ <request>
684
+ <param name="op" style="query" default="" type="xs:string">
685
+ <doc>The operation to be performed on the request. Mandatory. Currently only next_step is supported.</doc>
686
+ </param>
687
+ <param name="release_item" style="query" default="false" type="xs:string">
688
+ <doc>Boolean flag for indicating whether to release the item from the request.</doc>
689
+ </param>
690
+ </request>
691
+ <response>
692
+ <doc title="401652">General Error - An error has occurred while processing the request.</doc>
693
+ <doc title="401907">Failed to find a request for the given request ID.</doc>
694
+ <doc title="402205">Input parameter X (Y) is not numeric.</doc>
695
+ <doc title="401932">Request X is not a Digitization request</doc>
696
+ <doc title="401933">Cannot move forward in workflow. Request ID: X, Step: Y</doc>
697
+ <doc title="401934">Move digitization request to next step in workflow has failed. Request ID: X</doc>
698
+ <doc title="401666">X parameter is not valid.</doc>
699
+ <representation mediaType="application/xml">
700
+ <doc title="Request">rest_user_request.xsd</doc>
701
+ </representation>
702
+ <representation mediaType="application/json">
703
+ <doc title="Request">rest_user_request.xsd</doc>
704
+ </representation>
705
+ </response>
706
+ </method>
707
+ <method name="PUT">
708
+ <doc title="Update request">This Web service updates a user's request for a library resource.</doc>
709
+ <request>
710
+ <representation mediaType="application/xml">
711
+ <doc>This method takes a User Request object.</doc>
712
+ </representation>
713
+ <representation mediaType="application/json">
714
+ <doc>This method takes a User Request object.</doc>
715
+ </representation>
716
+ </request>
717
+ <response>
718
+ <representation mediaType="application/xml">
719
+ <doc title="User Request">rest_user_request.xsd</doc>
720
+ </representation>
721
+ <representation mediaType="application/json">
722
+ <doc title="User Request">rest_user_request.xsd</doc>
723
+ </representation>
724
+ </response>
725
+ </method>
726
+ </resource>
727
+ <resource path="{user_id}/resource_sharing_requests">
728
+ <param name="user_id" style="template" type="xs:string">
729
+ <doc>A unique identifier for the user</doc>
730
+ </param>
731
+ <method name="POST">
732
+ <doc title="Create user request for resource sharing">This Web service creates a user's request for resource sharing.</doc>
733
+ <request>
734
+ <param name="user_id_type" style="query" type="xs:string">
735
+ <doc>The type of identifier that is being searched. Optional. If this is not provided, all unique identifier types are used. The values that can be used are any of the values in the User Identifier Type code table.</doc>
736
+ </param>
737
+ <param name="override_blocks" style="query" type="xs:string">
738
+ <doc>Indication whether the request should be created even if blocks exist. optional. By default this is false.</doc>
739
+ </param>
740
+ <representation mediaType="application/xml">
741
+ <doc>This method takes a Resource Sharing Request object.</doc>
742
+ </representation>
743
+ <representation mediaType="application/json">
744
+ <doc>This method takes a Resource Sharing Request object.</doc>
745
+ </representation>
746
+ </request>
747
+ <response>
748
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
749
+ <doc title="401604">Warning: The institutional inventory has services for the requested title.</doc>
750
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
751
+ <doc title="402039">Could not create request, default item location is not defined for the resource sharing library</doc>
752
+ <doc title="401768">Patron is not affiliated with a resource sharing library</doc>
753
+ <doc title="402362">Failed to save the request: Patron has duplicate request</doc>
754
+ <doc title="401607">Resource sharing library (owner) is missing</doc>
755
+ <doc title="401608">The given resource sharing library (owner) is not defined in the patron record</doc>
756
+ <representation mediaType="application/xml">
757
+ <doc title="User Request for resource sharing">rest_user_resource_sharing_request.xsd</doc>
758
+ </representation>
759
+ <representation mediaType="application/json">
760
+ <doc title="User Request for resource sharing">rest_user_resource_sharing_request.xsd</doc>
761
+ </representation>
762
+ </response>
763
+ </method>
764
+ </resource>
765
+ <resource path="{user_id}/resource_sharing_requests/{request_id}">
766
+ <param name="user_id" style="template" type="xs:string">
767
+ <doc>A unique identifier for the user</doc>
768
+ </param>
769
+ <param name="request_id" style="template" type="xs:string">
770
+ <doc>The identifier of the resource sharing request.</doc>
771
+ </param>
772
+ <method name="GET">
773
+ <doc title="Retrieve user's resource sharing request.">This Web service retrieves a user's resource sharing request.</doc>
774
+ <request>
775
+ <param name="request_id_type" style="query" type="xs:string">
776
+ <doc>Request ID type. Optional. Use request_id_type=external to search by external identifier.</doc>
777
+ </param>
778
+ </request>
779
+ <response>
780
+ <doc title="401890">User with identifier X of type Y was not found.</doc>
781
+ <doc title="401652">General Error: An error has occurred while processing the request.</doc>
782
+ <doc title="40166450">No result found for given parameters.</doc>
783
+ <doc title="40166422">Value of parameter is invalid given other parameter.</doc>
784
+ <representation mediaType="application/xml">
785
+ <doc title="User Request for resource sharing">rest_user_resource_sharing_request.xsd</doc>
786
+ </representation>
787
+ <representation mediaType="application/json">
788
+ <doc title="User Request for resource sharing">rest_user_resource_sharing_request.xsd</doc>
789
+ </representation>
790
+ </response>
791
+ </method>
792
+ </resource>
793
+ </resource>
794
+ </resources>
795
+ </application>